diff options
Diffstat (limited to 'todolist/parser_test.go')
| -rw-r--r-- | todolist/parser_test.go | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/todolist/parser_test.go b/todolist/parser_test.go index 83c0602..791958c 100644 --- a/todolist/parser_test.go +++ b/todolist/parser_test.go @@ -26,11 +26,26 @@ func TestParseSubjectWithDue(t *testing.T) { } } +func TestParseExpandProjects(t *testing.T) { + assert := assert.New(t) + parser := &Parser{} + correctFormat := parser.ExpandProject("ex 113 +meeting: figures, slides, coffee, suger") + assert.Equal("+meeting", correctFormat) + wrongFormat1 := parser.ExpandProject("ex 114 +meeting figures, slides, coffee, suger") + assert.Equal("", wrongFormat1) + wrongFormat2 := parser.ExpandProject("ex 115 meeting: figures, slides, coffee, suger") + assert.Equal("", wrongFormat2) + wrongFormat3 := parser.ExpandProject("ex 116 meeting figures, slides, coffee, suger") + assert.Equal("", wrongFormat3) + wrongFormat4 := parser.ExpandProject("ex 117 +重要な會議: 図, コーヒー, 砂糖") + assert.Equal("+重要な會議", wrongFormat4) +} + func TestParseProjects(t *testing.T) { parser := &Parser{} - todo := parser.ParseNewTodo("do this thing +proj1 +proj2 due tomorrow") - if len(todo.Projects) != 2 { - t.Error("Expected Projects length to be 2") + todo := parser.ParseNewTodo("do this thing +proj1 +proj2 +專案3 due tomorrow") + if len(todo.Projects) != 3 { + t.Error("Expected Projects length to be 3") } if todo.Projects[0] != "proj1" { t.Error("todo.Projects[0] should equal 'proj1' but got", todo.Projects[0]) @@ -38,6 +53,9 @@ func TestParseProjects(t *testing.T) { if todo.Projects[1] != "proj2" { t.Error("todo.Projects[1] should equal 'proj2' but got", todo.Projects[1]) } + if todo.Projects[2] != "專案3" { + t.Error("todo.Projects[2] should equal '專案3' but got", todo.Projects[2]) + } } func TestParseContexts(t *testing.T) { |
