Add tests for empty string lists

This commit is contained in:
Svend Sorensen 2015-10-07 13:11:54 -07:00 committed by Anthony Stanton
parent f2f4ded970
commit 53f44878ff
1 changed files with 23 additions and 0 deletions

View File

@ -27,3 +27,26 @@ func TestStringList_element(t *testing.T) {
list, expected, actual) list, expected, actual)
} }
} }
func TestStringList_empty_slice(t *testing.T) {
expected := []string{}
l := NewStringList(expected)
actual := l.Slice()
if !reflect.DeepEqual(expected, actual) {
t.Fatalf("Expected %q, got %q", expected, actual)
}
}
func TestStringList_empty_slice_length(t *testing.T) {
list := []string{}
l := NewStringList([]string{})
actual := l.Length()
expected := 0
if actual != expected {
t.Fatalf("Expected length of %q to be %d, got %d",
list, expected, actual)
}
}