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

Function TestStatic_StringArray

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

Source from the content-addressed store, hash-verified

367}
368
369func TestStatic_StringArray(t *testing.T) {
370 tests := []struct {
371 arg any
372 ok bool
373 }{
374 // supported values
375 {arg: []string(nil), ok: true},
376 {arg: []string{}, ok: true},
377 {arg: []string{""}, ok: true},
378 {arg: []string{"aa"}, ok: true},
379 {arg: []string{"aa", "bb"}, ok: true},
380 // unsupported values
381 {arg: 1},
382 {arg: 3.14},
383 {arg: "test"},
384 {arg: true},
385 {arg: StatusOk},
386 {arg: KindClient},
387 {arg: []int{1, 2}},
388 {arg: []float64{1.0, 2.2}},
389 {arg: []bool{true, true}},
390 }
391
392 for _, tt := range tests {
393 t.Run(testName(tt.arg), func(t *testing.T) {
394 static := newStatic(tt.arg)
395 s, ok := static.StringArray()
396
397 require.Equal(t, tt.ok, ok)
398 if tt.ok {
399 assert.Equal(t, tt.arg, s)
400 }
401 })
402 }
403}
404
405func TestStatic_BooleanArray(t *testing.T) {
406 tests := []struct {

Callers

nothing calls this directly

Calls 5

testNameFunction · 0.85
newStaticFunction · 0.85
StringArrayMethod · 0.80
RunMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected