Skip to content

Commit

Permalink
Add tests for empty string lists
Browse files Browse the repository at this point in the history
  • Loading branch information
Svend Sorensen committed Oct 7, 2015
1 parent e26d3a1 commit 882ef6e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions config/string_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

0 comments on commit 882ef6e

Please sign in to comment.