MCPcopy
hub / github.com/google/gvisor / TestStringFromImmutableBytes

Function TestStringFromImmutableBytes

pkg/gohacks/string_test.go:55–86  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

53}
54
55func TestStringFromImmutableBytes(t *testing.T) {
56 tests := []struct {
57 name string
58 input []byte
59 want string
60 }{
61 {
62 name: "abc",
63 input: []byte("abc"),
64 want: "abc",
65 },
66 {
67 name: "empty",
68 input: []byte{},
69 want: "",
70 },
71 {
72 name: "nil",
73 input: nil,
74 want: "",
75 },
76 }
77
78 for _, tc := range tests {
79 t.Run(tc.name, func(t *testing.T) {
80 got := StringFromImmutableBytes(tc.input)
81 if got != tc.want {
82 t.Errorf("got %q want %q", got, tc.want)
83 }
84 })
85 }
86}

Callers

nothing calls this directly

Calls 3

StringFromImmutableBytesFunction · 0.70
RunMethod · 0.65
ErrorfMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…