aboutsummaryrefslogtreecommitdiffstats
path: root/todolist/parser_test.go
diff options
context:
space:
mode:
authorQuey-Liang Kao <nonerkao@gmail.com>2017-01-21 12:43:43 +0800
committerQuey-Liang Kao <nonerkao@gmail.com>2017-01-21 12:43:43 +0800
commit206a28076422758102fb7df322b218dfe4248deb (patch)
tree903fd573031c43c2f8d5219ecd2f682257392ea9 /todolist/parser_test.go
parent0d1eecc168321dbfd56d1fec55c7d6df5eee2c29 (diff)
Fix a bug and add some tests
Diffstat (limited to 'todolist/parser_test.go')
-rw-r--r--todolist/parser_test.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/todolist/parser_test.go b/todolist/parser_test.go
index 83c0602..15307cc 100644
--- a/todolist/parser_test.go
+++ b/todolist/parser_test.go
@@ -26,6 +26,19 @@ 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)
+}
+
func TestParseProjects(t *testing.T) {
parser := &Parser{}
todo := parser.ParseNewTodo("do this thing +proj1 +proj2 due tomorrow")