Skip to content

Commit

Permalink
Merge pull request #35 from f3ath/iregexp
Browse files Browse the repository at this point in the history
Add an edge case test that `.` matches \\u2029 and \\u2028
  • Loading branch information
gregsdennis authored May 8, 2024
2 parents bb3ae8c + 6878638 commit 7c8e9bc
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
64 changes: 64 additions & 0 deletions cts.json
Original file line number Diff line number Diff line change
Expand Up @@ -4824,6 +4824,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]",
Expand Down Expand Up @@ -5040,6 +5070,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]",
Expand Down
12 changes: 12 additions & 0 deletions tests/functions/match.json
Original file line number Diff line number Diff line change
Expand Up @@ -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]",
Expand Down
12 changes: 12 additions & 0 deletions tests/functions/search.json
Original file line number Diff line number Diff line change
Expand Up @@ -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]",
Expand Down

0 comments on commit 7c8e9bc

Please sign in to comment.