aboutsummaryrefslogtreecommitdiffstats
path: root/todolist/parser_test.go
diff options
context:
space:
mode:
authorQuey-Liang Kao <s101062801@m101.nthu.edu.tw>2017-08-14 16:37:40 +0800
committerQuey-Liang Kao <s101062801@m101.nthu.edu.tw>2017-08-14 16:37:40 +0800
commite1ed1a2357bbf5083e96c883071339235ac0f02e (patch)
tree400e6e82a90619e6c87865beec9d6880cb5f286d /todolist/parser_test.go
parent9f62f82025e4dd7fa3a0dfc50bb94704209e608c (diff)
parent7c24f39a0fc8bb07dc9db4f5fecd3468705b1e37 (diff)
Merge branch 'note' of github.com:NonerKao/todolist into note_patch_set
Diffstat (limited to 'todolist/parser_test.go')
-rw-r--r--todolist/parser_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/todolist/parser_test.go b/todolist/parser_test.go
index 476edaa..2c4fd25 100644
--- a/todolist/parser_test.go
+++ b/todolist/parser_test.go
@@ -74,6 +74,32 @@ 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])
+ }
+
+ if parser.ParseNotes(todo, "en 1 0 www.duckduckgo.com") != "edit" {
+ t.Error("Expected Notes to be editted")
+ }
+ if todo.Notes[0] != "www.duckduckgo.com" {
+ t.Error("Expected note 1 to be 'www.duckduckgo.com' but got", todo.Notes[0])
+ }
+
+ if parser.ParseNotes(todo, "dn 1 0") != "delete" {
+ t.Error("Expected Notes to be deleted")
+ }
+ if len(todo.Notes) != 0 {
+ t.Error("Expected no note")
+ }
+}
+
func TestDueToday(t *testing.T) {
assert := assert.New(t)
parser := &Parser{}