MCPcopy
hub / github.com/grafana/tempo / TestStatic_String

Function TestStatic_String

pkg/traceql/ast_test.go:126–157  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

124}
125
126func TestStatic_String(t *testing.T) {
127 tests := []struct {
128 arg any
129 want string
130 }{
131 {arg: nil, want: "nil"},
132 {arg: 101, want: "101"},
133 {arg: -10, want: "-10"},
134 {arg: -1.0, want: "-1.0"},
135 {arg: 0.0, want: "0.0"},
136 {arg: 10.0, want: "10.0"},
137 {arg: 12.34, want: "12.34"},
138 {arg: 1.23e+23, want: "1.23e+23"},
139 {arg: 12.34e+2, want: "1234.0"},
140 {arg: "test", want: "`test`"},
141 {arg: true, want: "true"},
142 {arg: StatusOk, want: "ok"},
143 {arg: KindClient, want: "client"},
144 {arg: time.Duration(70) * time.Second, want: "1m10s"},
145 {arg: []int{1, 2, 3}, want: "[1, 2, 3]"},
146 {arg: []float64{1.1, 3.3}, want: "[1.1, 3.3]"},
147 {arg: []bool{true, true, false}, want: "[true, true, false]"},
148 {arg: []string{"aa", "bb"}, want: "[`aa`, `bb`]"},
149 }
150
151 for _, tt := range tests {
152 t.Run(testName(tt.arg), func(t *testing.T) {
153 static := newStatic(tt.arg)
154 assert.Equal(t, tt.want, static.String())
155 })
156 }
157}
158
159func TestStatic_Bool(t *testing.T) {
160 tests := []struct {

Callers

nothing calls this directly

Calls 6

testNameFunction · 0.85
newStaticFunction · 0.85
DurationMethod · 0.80
RunMethod · 0.45
EqualMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected