X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=tests%2Fovsdb-types.at;h=d05277666cdf6e3550f1d773a5b39f59c6d867f5;hb=b89d8339252cd330daca7341bbd76c7316080127;hp=4647e69de45079f728d6e14ac571ddeb4eb8695d;hpb=0d0f05b909b6428d44eb147bd4edd73782d2a137;p=openvswitch diff --git a/tests/ovsdb-types.at b/tests/ovsdb-types.at index 4647e69d..d0527766 100644 --- a/tests/ovsdb-types.at +++ b/tests/ovsdb-types.at @@ -50,9 +50,24 @@ OVSDB_CHECK_POSITIVE([string reMatch], OVSDB_CHECK_POSITIVE([string reMatch + reComment], [[parse-base-type '{"type": "string", "reMatch": "\\d{3}-\\d{3}-\\d{4}", "reComment": "US-style telephone number"}']], [{"reComment":"US-style telephone number","reMatch":"\\d{3}-\\d{3}-\\d{4}","type":"string"}]) -OVSDB_CHECK_NEGATIVE([reMatch must be a valid JavaScript regexp], - [[parse-base-type '{"type": "string", "reMatch": "ab@:>@cd"}']], - [[test-ovsdb: invalid regular expression: "ab@:>@cd" is not a valid regular expression: @:>@ is an invalid data character in JavaScript compatibility mode]]) + +AT_SETUP([reMatch must be a valid regexp]) +AT_KEYWORDS([ovsdb negative]) +if test "$HAVE_PCRE" = yes; then + AT_CHECK( + [[test-ovsdb parse-base-type \ + '{"type": "string", "reMatch": "x{2,1}"}']], + [1], [], + [[test-ovsdb: invalid regular expression: "x{2,1}" is not a valid regular expression: numbers out of order in {} quantifier +]]) +else + AT_CHECK( + [[test-ovsdb parse-base-type \ + '{"type": "string", "reMatch": "x{2,1}"}']], + [0], [[{"reMatch":"x{2,1}","type":"string"} +]], []) +fi +AT_CLEANUP OVSDB_CHECK_POSITIVE([string minLength], [[parse-base-type '{"type": "string", "minLength": 1}']],