go.charczuk.com@v0.0.0-20240327042549-bc490516bd1a/sdk/assert/its_all.go (about) 1 /* 2 3 Copyright (c) 2023 - Present. Will Charczuk. All rights reserved. 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file at the root of the repository. 5 6 */ 7 8 package assert 9 10 import "testing" 11 12 // ItsAll is an assertion helper. 13 // 14 // It will test that all values in the slice match the filter. 15 func ItsAll[T any](t *testing.T, values []T, fn func(T) bool, message ...any) { 16 t.Helper() 17 for _, v := range values { 18 if !fn(v) { 19 Fatalf(t, "expected all slice values to match filter", nil, message) 20 } 21 } 22 }