Debian Codegraph @

util_test.go

raw
1 package check //nolint:testpackage // Testing unexported identifiers.
2
3 import (
4 "regexp"
5 "testing"
6 )
7
8 func TestFormat(tt *testing.T) {
9 tt.Parallel()
10 t := T(tt)
11 cases := []struct {
12 args []any
13 want string
14 }{
15 {[]any{}, ""},
16 {[]any{"msg"}, "msg"},
17 {[]any{"%s", "msg"}, "msg"},
18 {[]any{"one", "two"}, "one%!(EXTRA string=two)"},
19 {[]any{42}, "42"},
20 {[]any{regexp.MustCompile(".*")}, ".*"},
21 }
22 for i, v := range cases {
23 t.Equal(format(v.args...), v.want, i)
24 }
25 }
26
27 func TestCaller(tt *testing.T) {
28 tt.Parallel()
29 t := T(tt)
30 t.Equal(callerFuncName(0), "TestCaller")
31 t.Equal(callerFuncName(1000), "<unknown>")
32 }