Skip to content

Commit 7dad82a

Browse files
authored
Test JSON bool, null literal shorthand names (#110)
Section 2.5.1.1 defines shorthand names with this grammar: ```anbf member-name-shorthand = name-first *name-char name-first = ALPHA / "_" / %x80-D7FF / ; skip surrogate code points %xE000-10FFFF name-char = name-first / DIGIT ``` This allows shorthand names that correspond to the JSON literals `true`, `false`, and `null`. So add tests for this pattern.
1 parent 05f6cac commit 7dad82a

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

tests/basic.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,57 @@
564564
"$['o'][1]['a']"
565565
]
566566
},
567+
{
568+
"name": "name shorthand, true",
569+
"selector": "$.true",
570+
"document": {
571+
"true": "A",
572+
"_foo": "B"
573+
},
574+
"result": [
575+
"A"
576+
],
577+
"result_paths": [
578+
"$['true']"
579+
],
580+
"tags": [
581+
"boundary"
582+
]
583+
},
584+
{
585+
"name": "name shorthand, false",
586+
"selector": "$.false",
587+
"document": {
588+
"false": "A",
589+
"_foo": "B"
590+
},
591+
"result": [
592+
"A"
593+
],
594+
"result_paths": [
595+
"$['false']"
596+
],
597+
"tags": [
598+
"boundary"
599+
]
600+
},
601+
{
602+
"name": "name shorthand, null",
603+
"selector": "$.null",
604+
"document": {
605+
"null": "A",
606+
"_foo": "B"
607+
},
608+
"result": [
609+
"A"
610+
],
611+
"result_paths": [
612+
"$['null']"
613+
],
614+
"tags": [
615+
"boundary"
616+
]
617+
},
567618
{
568619
"name": "descendant segment, wildcard shorthand, array data",
569620
"selector": "$..*",

0 commit comments

Comments
 (0)