From 6878638dd20f117987608053e63fb90c4d7341b0 Mon Sep 17 00:00:00 2001 From: f3ath Date: Tue, 25 Apr 2023 20:50:09 -0700 Subject: [PATCH] Add an edge case test that `.` matches \\u2029 and \\u2028 --- cts.json | 64 +++++++++++++++++++++++++++++++++++++ tests/functions/match.json | 12 +++++++ tests/functions/search.json | 12 +++++++ 3 files changed, 88 insertions(+) diff --git a/cts.json b/cts.json index 413d08c..eba669d 100644 --- a/cts.json +++ b/cts.json @@ -3454,6 +3454,36 @@ "a𐄁b" ] }, + { + "name": "functions, match, dot matcher on \\u2028", + "selector": "$[?match(@, '.')]", + "document": [ + "
", + "\r", + "\n", + true, + [], + {} + ], + "result": [ + "
" + ] + }, + { + "name": "functions, match, dot matcher on \\u2029", + "selector": "$[?match(@, '.')]", + "document": [ + "
", + "\r", + "\n", + true, + [], + {} + ], + "result": [ + "
" + ] + }, { "name": "functions, match, result cannot be compared", "selector": "$[?match(@.a, 'a.*')==true]", @@ -3650,6 +3680,40 @@ "a𐄁bc" ] }, + { + "name": "functions, search, dot matcher on \\u2028", + "selector": "$[?search(@, '.')]", + "document": [ + "
", + "\r
\n", + "\r", + "\n", + true, + [], + {} + ], + "result": [ + "
", + "\r
\n" + ] + }, + { + "name": "functions, search, dot matcher on \\u2029", + "selector": "$[?search(@, '.')]", + "document": [ + "
", + "\r
\n", + "\r", + "\n", + true, + [], + {} + ], + "result": [ + "
", + "\r
\n" + ] + }, { "name": "functions, search, result cannot be compared", "selector": "$[?search(@.a, 'a.*')==true]", diff --git a/tests/functions/match.json b/tests/functions/match.json index 5964a21..cdf2745 100644 --- a/tests/functions/match.json +++ b/tests/functions/match.json @@ -71,6 +71,18 @@ "document": ["a\uD800\uDD01b", "ab", "1", true, [], {}], "result": ["a\uD800\uDD01b"] }, + { + "name": "dot matcher on \\u2028", + "selector": "$[?match(@, '.')]", + "document": ["\u2028", "\r", "\n", true, [], {}], + "result": ["\u2028"] + }, + { + "name": "dot matcher on \\u2029", + "selector": "$[?match(@, '.')]", + "document": ["\u2029", "\r", "\n", true, [], {}], + "result": ["\u2029"] + }, { "name": "result cannot be compared", "selector" : "$[?match(@.a, 'a.*')==true]", diff --git a/tests/functions/search.json b/tests/functions/search.json index f14659e..de8da49 100644 --- a/tests/functions/search.json +++ b/tests/functions/search.json @@ -86,6 +86,18 @@ "document": ["a\uD800\uDD01bc", "abc", "1", true, [], {}], "result": ["a\uD800\uDD01bc"] }, + { + "name": "dot matcher on \\u2028", + "selector": "$[?search(@, '.')]", + "document": ["\u2028", "\r\u2028\n", "\r", "\n", true, [], {}], + "result": ["\u2028", "\r\u2028\n"] + }, + { + "name": "dot matcher on \\u2029", + "selector": "$[?search(@, '.')]", + "document": ["\u2029", "\r\u2029\n", "\r", "\n", true, [], {}], + "result": ["\u2029", "\r\u2029\n"] + }, { "name": "result cannot be compared", "selector" : "$[?search(@.a, 'a.*')==true]",