diff options
Diffstat (limited to 'todolist/parser_test.go')
| -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) +} |
