go.charczuk.com@v0.0.0-20240327042549-bc490516bd1a/sdk/assert/fatalf.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 ( 11 "fmt" 12 "testing" 13 ) 14 15 // Fatalf is a helper to fatal a test with optional message components. 16 func Fatalf(t *testing.T, format string, args, message []any) { 17 t.Helper() 18 if len(message) > 0 { 19 t.Fatal(fmt.Sprintf(format, args...) + ": " + fmt.Sprint(message...)) 20 } else { 21 t.Fatalf(format, args...) 22 } 23 }