go.charczuk.com@v0.0.0-20240327042549-bc490516bd1a/sdk/assert/its_none.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  // ItsNone is an assertion helper.
    13  //
    14  // It will test that none of the values in the slice match the filter.
    15  func ItsNone[T comparable](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 no slice values to match filter", nil, message)
    20  		}
    21  	}
    22  }