diff options
| author | Michael Strùˆder <mikezter@gmail.com> | 2017-05-02 17:00:26 +0200 |
|---|---|---|
| committer | Grant Ammons <gammons@gmail.com> | 2017-05-09 20:20:24 -0400 |
| commit | d2df88f217cef638bdca527794969fcaa835bfd7 (patch) | |
| tree | 1bfaf3b8e64aa870bf7821fe39ebb81e8b9df615 | |
| parent | c12bbb27b6268d2f3eedc56234a46e54d010e3f2 (diff) | |
add test for func (p Parser) Parse()
| -rw-r--r-- | todolist/parser_test.go | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/todolist/parser_test.go b/todolist/parser_test.go index 8cd6b53..9dfa454 100644 --- a/todolist/parser_test.go +++ b/todolist/parser_test.go @@ -169,3 +169,24 @@ func TestDueIntelligentlyChoosesCorrectYear(t *testing.T) { assert.Equal("2017-01-10", parser.parseArbitraryDate("jan 10", septemberTime)) assert.Equal("2017-01-10", parser.parseArbitraryDate("jan 10", decemberTime)) } + +func TestParseCommandIdSubject(t *testing.T) { + assert := assert.New(t) + parser := Parser{"es 24 a new subject"} + command, id, subject := parser.Parse() + + assert.Equal("es", command) + assert.Equal(24, id) + assert.Equal("a new subject", subject) +} + +func TestParseInvalidCommandIdSubject(t *testing.T) { + assert := assert.New(t) + input := "es a new project" + parser := Parser{input} + command, id, subject := parser.Parse() + + assert.Equal("", command) + assert.Equal(-1, id) + assert.Equal(input, subject) +} |
