Skip to content

Commit 184d42a

Browse files
committed
while we're here, add some simple test cases
1 parent 7040cf4 commit 184d42a

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

pkg/todos/todos_test.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package todos
2+
3+
import (
4+
"testing"
5+
6+
"github.com/augmentable-dev/lege"
7+
"github.com/augmentable-dev/tickgit/pkg/comments"
8+
)
9+
10+
func TestNewToDoNil(t *testing.T) {
11+
collection := lege.NewCollection(lege.Location{}, lege.Location{}, lege.Boundary{}, "Hello World")
12+
comment := comments.Comment{
13+
Collection: *collection,
14+
}
15+
todo := NewToDo(comment)
16+
17+
if todo != nil {
18+
t.Fatalf("did not expect a TODO, got: %v", todo)
19+
}
20+
}
21+
22+
func TestNewToDo(t *testing.T) {
23+
collection := lege.NewCollection(lege.Location{}, lege.Location{}, lege.Boundary{}, "TODO Hello World")
24+
comment := comments.Comment{
25+
Collection: *collection,
26+
}
27+
todo := NewToDo(comment)
28+
29+
if todo == nil {
30+
t.Fatalf("expected a TODO, got: %v", todo)
31+
}
32+
33+
if todo.Phrase != "TODO" {
34+
t.Fatalf("expected matched phrase to be TODO, got: %s", todo.Phrase)
35+
}
36+
}

0 commit comments

Comments
 (0)