Skip to content

Commit

Permalink
fix: finish last test
Browse files Browse the repository at this point in the history
  • Loading branch information
FredrikOseberg committed Sep 27, 2023
1 parent 94ece70 commit 921b3f8
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,21 @@ func TestEvery(t *testing.T) {
t.Errorf("Expected result to be false")
}
})

t.Run("Result should be false if one doesn't match the predicate", func(t *testing.T) {
words := []string{"apple", "banana", "cherry", "he"}
allLong := every(words, func(item interface{}) bool {
str, ok := item.(string)
if !ok {
t.Errorf("Expected a string, got %T", item)
return false
}
return len(str) > 3
})
if allLong == true {
t.Errorf("Expected all words to be long, but got false")
}
})
}

func TestContains(t *testing.T) {
Expand Down

0 comments on commit 921b3f8

Please sign in to comment.