From 882ef6ebade9d3488295c24ca09449e92f4e19de Mon Sep 17 00:00:00 2001 From: Svend Sorensen Date: Wed, 7 Oct 2015 13:11:54 -0700 Subject: [PATCH] Add tests for empty string lists --- config/string_list_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/config/string_list_test.go b/config/string_list_test.go index 64049eb502e5..3fe57dfe2846 100644 --- a/config/string_list_test.go +++ b/config/string_list_test.go @@ -27,3 +27,26 @@ func TestStringList_element(t *testing.T) { 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) + } +}