From fdca747e173c20f59901207c3f1887cece2a9351 Mon Sep 17 00:00:00 2001 From: Michael Strùˆder Date: Wed, 3 May 2017 15:18:13 +0200 Subject: subcommands like delete don't take a subject, so make it optional --- todolist/parser_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'todolist/parser_test.go') diff --git a/todolist/parser_test.go b/todolist/parser_test.go index 05f390a..4466489 100644 --- a/todolist/parser_test.go +++ b/todolist/parser_test.go @@ -170,6 +170,16 @@ func TestDueIntelligentlyChoosesCorrectYear(t *testing.T) { assert.Equal("2017-01-10", parser.parseArbitraryDate("jan 10", decemberTime)) } +func TestParseCommandIdSubjectOptionalSubject(t *testing.T) { + assert := assert.New(t) + parser := Parser{"d 24"} + command, id, subject := parser.Parse() + + assert.Equal("d", command) + assert.Equal(24, id) + assert.Equal("", subject) +} + func TestParseCommandIdSubjectWhitespace(t *testing.T) { assert := assert.New(t) parser := Parser{"es 24\t a new subject"} -- cgit v1.3