MCPcopy Index your code
hub / github.com/google/mangle / TestPredicateNameNegative

Function TestPredicateNameNegative

parse/parse_test.go:1056–1106  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1054}
1055
1056func TestPredicateNameNegative(t *testing.T) {
1057 tests := []struct {
1058 name string
1059 str string
1060 }{
1061 {
1062 name: "bad constant",
1063 str: "/",
1064 },
1065 {
1066 name: "bad constant 2",
1067 str: "/bar/",
1068 },
1069 {
1070 name: "bad constant 3",
1071 str: "//",
1072 },
1073 {
1074 name: "bad constant unterminated",
1075 str: "/\"",
1076 },
1077 {
1078 name: "bad constant string part",
1079 str: "/prefix/\"string\"",
1080 },
1081 {
1082 name: "negated constant?!",
1083 str: "!/bar",
1084 },
1085 {
1086 name: "negated variable?!",
1087 str: "!X",
1088 },
1089
1090 {
1091 name: "number too big",
1092 str: "287326487236487264378264",
1093 },
1094 {
1095 name: "number part",
1096 str: "/catch/[22]",
1097 },
1098 }
1099 for _, test := range tests {
1100 t.Run(test.name, func(t *testing.T) {
1101 if got, err := PredicateName(test.str); err == nil && got != "" { // if no error
1102 t.Errorf("PredicateName(%v) = %q want error or empty string", test.str, got)
1103 }
1104 })
1105 }
1106}
1107
1108func TestParseNotAtom(t *testing.T) {
1109 tests := []struct {

Callers

nothing calls this directly

Calls 1

PredicateNameFunction · 0.85

Tested by

no test coverage detected