MCPcopy
hub / github.com/expr-lang/expr / TestMaxNodes

Function TestMaxNodes

expr_test.go:2841–2855  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2839}
2840
2841func TestMaxNodes(t *testing.T) {
2842 maxNodes := uint(100)
2843
2844 code := ""
2845 for i := 0; i < int(maxNodes); i++ {
2846 code += "1; "
2847 }
2848
2849 _, err := expr.Compile(code, expr.MaxNodes(maxNodes))
2850 require.Error(t, err)
2851 assert.Contains(t, err.Error(), "exceeds maximum allowed nodes")
2852
2853 _, err = expr.Compile(code, expr.MaxNodes(maxNodes+1))
2854 require.NoError(t, err)
2855}
2856
2857func TestMaxNodesDisabled(t *testing.T) {
2858 code := ""

Callers

nothing calls this directly

Calls 6

CompileFunction · 0.92
MaxNodesFunction · 0.92
ErrorFunction · 0.92
ContainsFunction · 0.92
NoErrorFunction · 0.92
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…