// assert_test.go - utility function for tests // // (c) 2024 Sudhi Herle // // Licensing Terms: GPLv2 // // If you need a commercial license for this work, please contact // the author. // // This software does not come with any express or implied // warranty; it is provided "as is". No claim is made to its // suitability for any purpose. package sieve_test import ( "fmt" "runtime" "testing" ) func newAsserter(t *testing.T) func(cond bool, msg string, args ...interface{}) { return func(cond bool, msg string, args ...interface{}) { if cond { return } _, file, line, ok := runtime.Caller(1) if !ok { file = "???" line = 0 } s := fmt.Sprintf(msg, args...) t.Fatalf("%s: %d: Assertion failed: %s\n", file, line, s) } }