From b1607ce3bfaf54936338d8639087dee52f7d7bc2 Mon Sep 17 00:00:00 2001 From: Stuart Skelton Date: Sat, 12 Aug 2017 17:35:05 +0100 Subject: Have a util function to pluralize todo. --- todolist/util_test.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 todolist/util_test.go (limited to 'todolist/util_test.go') diff --git a/todolist/util_test.go b/todolist/util_test.go new file mode 100644 index 0000000..40ecb54 --- /dev/null +++ b/todolist/util_test.go @@ -0,0 +1,13 @@ +package todolist + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestPluralize(t *testing.T) { + assert := assert.New(t) + assert.Equal("todo", pluralize(1, "todo", "todos")) + assert.Equal("todos", pluralize(2, "todo", "todos")) +} -- cgit v1.3