(t *testing.T)
| 3696 | } |
| 3697 | |
| 3698 | func 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 | |
| 3721 | var client *dgraphapi.GrpcClient |
| 3722 | var dc dgraphapi.Cluster |
nothing calls this directly
no test coverage detected