aboutsummaryrefslogtreecommitdiffstats
path: root/todolist/parser_test.go
diff options
context:
space:
mode:
authorQuey-Liang Kao <s101062801@m101.nthu.edu.tw>2017-08-14 14:41:40 +0800
committerQuey-Liang Kao <s101062801@m101.nthu.edu.tw>2017-08-14 14:58:32 +0800
commit5d28dac9b2e1d153f33551b968ab4c92cfce23ce (patch)
treeb323964d5a61014105b0884e81c9d88be1a74118 /todolist/parser_test.go
parent49ab75141a7799aa746765547bd74cb07b45bfee (diff)
Implement the "an" feature: Adding notes to todos
This patch introduce a new attribute of a todo item, which is "Notes", of type []string. The following enhancing patches will contain the listing, removing and editing features.
Diffstat (limited to 'todolist/parser_test.go')
-rw-r--r--todolist/parser_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/todolist/parser_test.go b/todolist/parser_test.go
index 476edaa..9412bdf 100644
--- a/todolist/parser_test.go
+++ b/todolist/parser_test.go
@@ -74,6 +74,18 @@ func TestParseContexts(t *testing.T) {
}
}
+func TestParseNotes(t *testing.T) {
+ parser := &Parser{}
+ todo := parser.ParseNewTodo("add search engine survey")
+
+ if parser.ParseNotes(todo, "an 1 www.google.com") != "add" {
+ t.Error("Expected Notes to be added")
+ }
+ if todo.Notes[0] != "www.google.com" {
+ t.Error("Expected note 1 to be 'www.google.com' but got", todo.Notes[0])
+ }
+}
+
func TestDueToday(t *testing.T) {
assert := assert.New(t)
parser := &Parser{}