MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / TestInvalidRegex

Function TestInvalidRegex

query/query0_test.go:3698–3719  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3696}
3697
3698func TestInvalidRegex(t *testing.T) {
3699 // This bug was fixed in commit e0cc0450b88593b7496c0947aea016fc6457cb61
3700 dgraphtest.ShouldSkipTest(t, "e0cc0450b88593b7496c0947aea016fc6457cb61", dc.GetVersion())
3701
3702 testCases := []struct {
3703 regex string
3704 errStr string
3705 }{
3706 {"/", "invalid"},
3707 {"", "empty"},
3708 {"/?", "invalid"},
3709 {"=/?", "invalid"},
3710 {"aman/", "invalid"},
3711 }
3712 for i, tc := range testCases {
3713 t.Run(fmt.Sprintf("test%d regex=%v", i, tc.regex), func(t *testing.T) {
3714 vars := map[string]string{"$name": tc.regex}
3715 _, err := processQueryWithVars(t, `query q($name:string){ q(func: regexp(dgraph.type, $name)) {}}`, vars)
3716 require.Contains(t, strings.ToLower(err.Error()), tc.errStr)
3717 })
3718 }
3719}
3720
3721var client *dgraphapi.GrpcClient
3722var dc dgraphapi.Cluster

Callers

nothing calls this directly

Calls 5

ShouldSkipTestFunction · 0.92
processQueryWithVarsFunction · 0.70
GetVersionMethod · 0.65
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected