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

Function TestVisitor_ConstantNode

checker/checker_test.go:746–757  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

744}
745
746func TestVisitor_ConstantNode(t *testing.T) {
747 tree, err := parser.Parse(`re("[a-z]")`)
748 require.NoError(t, err)
749
750 regexValue := regexp.MustCompile("[a-z]")
751 constNode := &ast.ConstantNode{Value: regexValue}
752 ast.Patch(&tree.Node, constNode)
753
754 _, err = checker.Check(tree, nil)
755 assert.NoError(t, err)
756 assert.Equal(t, reflect.TypeOf(regexValue), tree.Node.Type())
757}
758
759func TestCheck_AsBool(t *testing.T) {
760 tree, err := parser.Parse(`1+2`)

Callers

nothing calls this directly

Calls 7

ParseFunction · 0.92
NoErrorFunction · 0.92
PatchFunction · 0.92
CheckFunction · 0.92
NoErrorFunction · 0.92
EqualFunction · 0.92
TypeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…