Skip to content

Commit d554778

Browse files
committed
Tests functions that return special nothing
1 parent e5fd6fa commit d554778

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed

cts.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2397,6 +2397,32 @@
23972397
}
23982398
]
23992399
},
2400+
{
2401+
"name": "filter, equals, special nothing",
2402+
"selector": "$.values[?length(@.a) == value($..c)]",
2403+
"document": {
2404+
"c": "cd",
2405+
"values": [
2406+
{
2407+
"a": "ab"
2408+
},
2409+
{
2410+
"c": "d"
2411+
},
2412+
{
2413+
"a": null
2414+
}
2415+
]
2416+
},
2417+
"result": [
2418+
{
2419+
"c": "d"
2420+
},
2421+
{
2422+
"a": null
2423+
}
2424+
]
2425+
},
24002426
{
24012427
"name": "index selector, first element",
24022428
"selector": "$[0]",
@@ -4110,6 +4136,26 @@
41104136
}
41114137
]
41124138
},
4139+
{
4140+
"name": "functions, length, arg is special nothing",
4141+
"selector": "$[?length(value(@.a))>0]",
4142+
"document": [
4143+
{
4144+
"a": "ab"
4145+
},
4146+
{
4147+
"c": "d"
4148+
},
4149+
{
4150+
"a": null
4151+
}
4152+
],
4153+
"result": [
4154+
{
4155+
"a": "ab"
4156+
}
4157+
]
4158+
},
41134159
{
41144160
"name": "functions, match, found match",
41154161
"selector": "$[?match(@.a, 'a.*')]",

tests/filter.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,22 @@
770770
"result": [
771771
{"a": 0.011, "d": "e"}
772772
]
773+
},
774+
{
775+
"name": "equals, special nothing",
776+
"selector" : "$.values[?length(@.a) == value($..c)]",
777+
"document" : {
778+
"c": "cd",
779+
"values": [
780+
{"a": "ab"},
781+
{"c": "d"},
782+
{"a": null}
783+
]
784+
},
785+
"result": [
786+
{"c": "d"},
787+
{"a": null}
788+
]
773789
}
774790
]
775791
}

tests/functions/length.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,18 @@
8282
"result": [
8383
{"a": "ab"}
8484
]
85+
},
86+
{
87+
"name": "arg is special nothing",
88+
"selector" : "$[?length(value(@.a))>0]",
89+
"document" : [
90+
{"a": "ab"},
91+
{"c": "d"},
92+
{"a": null}
93+
],
94+
"result": [
95+
{"a": "ab"}
96+
]
8597
}
8698
]
8799
}

0 commit comments

Comments
 (0)