-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for filter without surrounding parenthesis
- Loading branch information
Showing
1 changed file
with
4 additions
and
2 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 |
---|---|---|
|
@@ -24,7 +24,9 @@ public class JsonPathQueryTokenizerTests | |
[DataRow( "$.store.book[0,1]", "{$|k};{store|k};{book|k};{1,0|s}" )] | ||
[DataRow( "$..book['category','author']", "{$|k};{..|s};{book|k};{author,category|s}" )] | ||
[DataRow( "$..book[?(@.isbn)]", "{$|k};{..|s};{book|k};{?(@.isbn)|s}" )] | ||
[DataRow( "$..book[[email protected]]", "{$|k};{..|s};{book|k};{[email protected]|s}" )] | ||
[DataRow( "$..book[?(@.price<10)]", "{$|k};{..|s};{book|k};{?(@.price<10)|s}" )] | ||
[DataRow( "$..book[[email protected]<10]", "{$|k};{..|s};{book|k};{[email protected]<10|s}" )] | ||
[DataRow( "$..*", "{$|k};{..|s};{*|s}" )] | ||
[DataRow( """$.store.book[?(@path !== "$['store']['book'][0]")]""", """{$|k};{store|k};{book|k};{?(@path !== "$['store']['book'][0]")|s}""" )] | ||
[DataRow( """$..book[?(@.price == 8.99 && @.category == "fiction")]""", """{$|k};{..|s};{book|k};{?(@.price == 8.99 && @.category == "fiction")|s}""" )] | ||
|
@@ -33,6 +35,8 @@ public void Should_tokenize_json_path( string jsonPath, string expected ) | |
// arrange | ||
static string TokensToString( JsonPathSegment segment ) | ||
{ | ||
return string.Join( ';', segment.AsEnumerable().Select( TokenToString ) ); | ||
|
||
static string TokenToString( JsonPathSegment segment ) | ||
{ | ||
var (keySelector, selectors) = segment; | ||
|
@@ -41,8 +45,6 @@ static string TokenToString( JsonPathSegment segment ) | |
|
||
return $"{{{selectorsString}|{selectorType}}}"; | ||
} | ||
|
||
return string.Join( ';', segment.AsEnumerable().Select( TokenToString ) ); | ||
} | ||
|
||
// act | ||
|