MCPcopy Create free account
hub / github.com/cel-expr/cel-go / TestMaxID

Function TestMaxID

common/ast/ast_test.go:383–394  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

381}
382
383func TestMaxID(t *testing.T) {
384 checked := mustTypeCheck(t, `has({'a':'key'}.key)`)
385 maxID := ast.MaxID(checked)
386 checked.SourceInfo().SetMacroCall(
387 maxID+2,
388 ast.NewExprFactory().NewIdent(maxID+1, "dummy"))
389 // Max ID always pads by 1 between invocations, and it's called twice here
390 // due to the presence of the macro which was injected after the fact.
391 if ast.MaxID(checked) != maxID+4 {
392 t.Errorf("ast.MaxID() got %v, wanted %d", ast.MaxID(checked), maxID+4)
393 }
394}
395
396func TestHeights(t *testing.T) {
397 tests := []struct {

Callers

nothing calls this directly

Calls 6

MaxIDFunction · 0.92
NewExprFactoryFunction · 0.92
mustTypeCheckFunction · 0.85
NewIdentMethod · 0.65
SetMacroCallMethod · 0.45
SourceInfoMethod · 0.45

Tested by

no test coverage detected