diff options
Diffstat (limited to 'todolist/parser_test.go')
| -rw-r--r-- | todolist/parser_test.go | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/todolist/parser_test.go b/todolist/parser_test.go index 37a4910..83c0602 100644 --- a/todolist/parser_test.go +++ b/todolist/parser_test.go @@ -2,6 +2,7 @@ package todolist import ( "fmt" + "strconv" "testing" "time" @@ -81,7 +82,8 @@ func TestDueSpecific(t *testing.T) { assert := assert.New(t) parser := &Parser{} todo := parser.ParseNewTodo("do this thing with @bob and @mary due jun 1") - assert.Equal("2016-06-01", todo.Due) + year := strconv.Itoa(time.Now().Year()) + assert.Equal(fmt.Sprintf("%s-06-01", year), todo.Due) } func TestMondayOnSunday(t *testing.T) { @@ -122,14 +124,16 @@ func TestTuesdayOnWednesday(t *testing.T) { func TestDueOnSpecificDate(t *testing.T) { assert := assert.New(t) parser := &Parser{} - assert.Equal("2016-05-02", parser.Due("due may 2", time.Now())) - assert.Equal("2016-06-01", parser.Due("due jun 1", time.Now())) + year := strconv.Itoa(time.Now().Year()) + assert.Equal(fmt.Sprintf("%s-05-02", year), parser.Due("due may 2", time.Now())) + assert.Equal(fmt.Sprintf("%s-06-01", year), parser.Due("due jun 1", time.Now())) } func TestDueOnSpecificDateEuropean(t *testing.T) { assert := assert.New(t) parser := &Parser{} - assert.Equal("2016-05-02", parser.Due("due 2 may", time.Now())) + year := strconv.Itoa(time.Now().Year()) + assert.Equal(fmt.Sprintf("%s-05-02", year), parser.Due("due 2 may", time.Now())) } func TestDueIntelligentlyChoosesCorrectYear(t *testing.T) { |
