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

Function TestRootExprIsNoop

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

Source from the content-addressed store, hash-verified

11)
12
13func TestRootExprIsNoop(t *testing.T) {
14 noops := []string{
15 "{false}",
16 "{1=0}",
17 "({false})",
18 "{false} && {false}",
19 "{false} >> {false}",
20 }
21
22 for _, q := range noops {
23 expr, err := Parse(q)
24 require.NoError(t, err)
25 require.True(t, expr.IsNoop(), "Query should be noop: %v", q)
26 }
27
28 ops := []string{
29 "{true}",
30 "{1=1}",
31 "{.foo = 1}",
32 "{false} || {true}",
33
34 // This is a noop but not yet detected
35 "{false} && {true}",
36 }
37
38 for _, q := range ops {
39 expr, err := Parse(q)
40 require.NoError(t, err)
41 require.False(t, expr.IsNoop(), "Query should not be noop: %v", q)
42 }
43}
44
45func TestNewStaticNil(t *testing.T) {
46 s := NewStaticNil()

Callers

nothing calls this directly

Calls 2

ParseFunction · 0.85
IsNoopMethod · 0.80

Tested by

no test coverage detected