Skip to content

Commit 93feb70

Browse files
committed
test matching with numerics
Without the error propagation change, the comparison of int to string aborts (rather than returning an error).
1 parent 24904ae commit 93feb70

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/libmongoc/tests/bsonutil/bson-match.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,9 @@ test_match (void)
570570
{"$$type array match", "{'a': {'$$type': ['string', 'int']}}", "{'a': 1}", true},
571571
{"$$type array mismatch", "{'a': {'$$type': ['string', 'int']}}", "{'a': 1.2}", false},
572572
{"extra keys in root ok", "{'a': 1}", "{'a': 1, 'b': 2}", true},
573-
{"extra keys in subdoc not ok", "{'a': {'b': 1}}", "{'a': {'b': 1, 'c': 2}}", false}};
573+
{"extra keys in subdoc not ok", "{'a': {'b': 1}}", "{'a': {'b': 1, 'c': 2}}", false},
574+
{"numeric type mismatch is ok", "{'a': 1}", "{'a': 1.0}", true},
575+
{"comparing number to string is an error", "{'a': 1}", "{'a': 'foo'}", false}};
574576
int i;
575577

576578
for (i = 0; i < sizeof (tests) / sizeof (testcase_t); i++) {

0 commit comments

Comments
 (0)