Skip to content

Commit

Permalink
add test for getting non-existing item from named collection
Browse files Browse the repository at this point in the history
  • Loading branch information
blotus committed Nov 7, 2024
1 parent 1a8f57c commit f8e778f
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions internal/collections/named_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,21 @@ func TestNames(t *testing.T) {
t.Errorf("Error finding string, got %d instead of 2", len(r))
}

r = names.FindString("nonexistent")

if len(r) != 0 {
t.Errorf("Error finding nonexistent, got %d instead of 0", len(r))
}

r = names.FindRegex(regexp.MustCompile("key.*"))

if len(r) != 3 {
t.Errorf("Error finding regex, got %d instead of 3", len(r))
}

r = names.FindRegex(regexp.MustCompile("nonexistent"))

if len(r) != 0 {
t.Errorf("Error finding nonexistent regex, got %d instead of 0", len(r))
}
}

0 comments on commit f8e778f

Please sign in to comment.