-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for invalid and uncommon filter literal values
- Loading branch information
1 parent
c252118
commit f4067cd
Showing
1 changed file
with
132 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -791,6 +791,14 @@ | |
}, | ||
{ | ||
"name": "equals number, zero and negative zero", | ||
"selector" : "$[[email protected]==0]", | ||
"document" : [{"a": -0, "d": "e"}, {"a":0.1, "d": "f"}, {"a":"0", "d": "g"}], | ||
"result": [ | ||
{"a": -0, "d": "e"} | ||
] | ||
}, | ||
{ | ||
"name": "equals number, negative zero and zero", | ||
"selector" : "$[[email protected]==-0]", | ||
"document" : [{"a": 0, "d": "e"}, {"a":0.1, "d": "f"}, {"a":"0", "d": "g"}], | ||
"result": [ | ||
|
@@ -813,6 +821,14 @@ | |
{"a": 100, "d": "e"} | ||
] | ||
}, | ||
{ | ||
"name": "equals number, exponent upper e", | ||
"selector" : "$[[email protected]==1E2]", | ||
"document" : [{"a": 100, "d": "e"}, {"a":100.1, "d": "f"}, {"a":"100", "d": "g"}], | ||
"result": [ | ||
{"a": 100, "d": "e"} | ||
] | ||
}, | ||
{ | ||
"name": "equals number, positive exponent", | ||
"selector" : "$[[email protected]==1e+2]", | ||
|
@@ -829,6 +845,22 @@ | |
{"a": 0.01, "d": "e"} | ||
] | ||
}, | ||
{ | ||
"name": "equals number, exponent leading 0", | ||
"selector" : "$[[email protected]==1e-02]", | ||
"document" : [{"a": 0.01, "d": "e"}, {"a":0.02, "d": "f"}, {"a":"0.01", "d": "g"}], | ||
"result": [ | ||
{"a": 0.01, "d": "e"} | ||
] | ||
}, | ||
{ | ||
"name": "equals number, exponent 00", | ||
"selector" : "$[[email protected]==1e+00]", | ||
"document" : [{"a": 1, "d": "e"}, {"a":2, "d": "f"}, {"a":"1", "d": "g"}], | ||
"result": [ | ||
{"a": 1, "d": "e"} | ||
] | ||
}, | ||
{ | ||
"name": "equals number, decimal fraction", | ||
"selector" : "$[[email protected]==1.1]", | ||
|
@@ -837,11 +869,6 @@ | |
{"a": 1.1, "d": "e"} | ||
] | ||
}, | ||
{ | ||
"name": "equals number, decimal fraction, no fractional digit", | ||
"selector" : "$[[email protected]==1.]", | ||
"invalid_selector": true | ||
}, | ||
{ | ||
"name": "equals number, decimal fraction, exponent", | ||
"selector" : "$[[email protected]==1.1e2]", | ||
|
@@ -866,6 +893,91 @@ | |
{"a": 0.011, "d": "e"} | ||
] | ||
}, | ||
{ | ||
"name": "equals number, invalid plus", | ||
"selector" : "$[[email protected]==+1]", | ||
"invalid_selector": true | ||
}, | ||
{ | ||
"name": "equals number, invalid minus space", | ||
"selector" : "$[[email protected]==- 1]", | ||
"invalid_selector": true | ||
}, | ||
{ | ||
"name": "equals number, invalid double minus", | ||
"selector" : "$[[email protected]==--1]", | ||
"invalid_selector": true | ||
}, | ||
{ | ||
"name": "equals number, invalid no int digit", | ||
"selector" : "$[[email protected]==.1]", | ||
"invalid_selector": true | ||
}, | ||
{ | ||
"name": "equals number, invalid minus no int digit", | ||
"selector" : "$[[email protected]==-.1]", | ||
"invalid_selector": true | ||
}, | ||
{ | ||
"name": "equals number, invalid 00", | ||
"selector" : "$[[email protected]==00]", | ||
"invalid_selector": true | ||
}, | ||
{ | ||
"name": "equals number, invalid leading 0", | ||
"selector" : "$[[email protected]==01]", | ||
"invalid_selector": true | ||
}, | ||
{ | ||
"name": "equals number, invalid no fractional digit", | ||
"selector" : "$[[email protected]==1.]", | ||
"invalid_selector": true | ||
}, | ||
{ | ||
"name": "equals number, invalid middle minus", | ||
"selector" : "$[[email protected]==1.-1]", | ||
"invalid_selector": true | ||
}, | ||
{ | ||
"name": "equals number, invalid no fractional digit e", | ||
"selector" : "$[[email protected]==1.e1]", | ||
"invalid_selector": true | ||
}, | ||
{ | ||
"name": "equals number, invalid no e digit", | ||
"selector" : "$[[email protected]==1e]", | ||
"invalid_selector": true | ||
}, | ||
{ | ||
"name": "equals number, invalid no e digit minus", | ||
"selector" : "$[[email protected]==1e-]", | ||
"invalid_selector": true | ||
}, | ||
{ | ||
"name": "equals number, invalid double e", | ||
"selector" : "$[[email protected]==1eE1]", | ||
"invalid_selector": true | ||
}, | ||
{ | ||
"name": "equals number, invalid e digit double minus", | ||
"selector" : "$[[email protected]==1e--1]", | ||
"invalid_selector": true | ||
}, | ||
{ | ||
"name": "equals number, invalid e digit plus minus", | ||
"selector" : "$[[email protected]==1e+-1]", | ||
"invalid_selector": true | ||
}, | ||
{ | ||
"name": "equals number, invalid e decimal", | ||
"selector" : "$[[email protected]==1e2.3]", | ||
"invalid_selector": true | ||
}, | ||
{ | ||
"name": "equals number, invalid multi e", | ||
"selector" : "$[[email protected]==1e2e3]", | ||
"invalid_selector": true | ||
}, | ||
{ | ||
"name": "equals, special nothing", | ||
"selector" : "$.values[?length(@.a) == value($..c)]", | ||
|
@@ -1037,6 +1149,21 @@ | |
"name": "or, left hand literal must be compared", | ||
"selector" : "$[?false || true == false]", | ||
"invalid_selector": true | ||
}, | ||
{ | ||
"name": "true, incorrectly capitalized", | ||
"selector" : "$[?@==True]", | ||
"invalid_selector": true | ||
}, | ||
{ | ||
"name": "false, incorrectly capitalized", | ||
"selector" : "$[?@==False]", | ||
"invalid_selector": true | ||
}, | ||
{ | ||
"name": "null, incorrectly capitalized", | ||
"selector" : "$[?@==Null]", | ||
"invalid_selector": true | ||
} | ||
] | ||
} |