Skip to content

Commit a1dbfa7

Browse files
committed
Updated reference to compliance tests.
1 parent 50d4985 commit a1dbfa7

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

jmespath.test/tests/ternary.json

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
[
2+
{
3+
"given": {
4+
"true": true,
5+
"false": false,
6+
"foo": "foo",
7+
"bar": "bar",
8+
"baz": "baz",
9+
"qux": "qux",
10+
"quux": "quux",
11+
"two": 2,
12+
"fourty": 40
13+
},
14+
"cases": [
15+
{
16+
"expression": "true ? foo : bar",
17+
"result": "foo"
18+
},
19+
{
20+
"expression": "false ? foo : bar",
21+
"result": "bar"
22+
},
23+
{
24+
"expression": "`null` ? foo : bar",
25+
"result": "bar"
26+
},
27+
{
28+
"expression": "`[]` ? foo : bar",
29+
"result": "bar"
30+
},
31+
{
32+
"expression": "`{}` ? foo : bar",
33+
"result": "bar"
34+
},
35+
{
36+
"expression": "'' ? foo : bar",
37+
"result": "bar"
38+
},
39+
{
40+
"comment": "chained ternaries",
41+
"expression": "foo ? bar ? baz : qux : quux",
42+
"result": "baz"
43+
},
44+
{
45+
"comment": "precedence with pipes",
46+
"expression": "false ? foo | bar | @ : baz",
47+
"result": "baz"
48+
},
49+
{
50+
"comment": "precedence with arithmetics",
51+
"expression": "foo ? fourty + two : `false`",
52+
"result": 42
53+
},
54+
{
55+
"comment": "precedence with logical operators",
56+
"expression": "true || false ? foo : bar",
57+
"result": "foo"
58+
},
59+
{
60+
"comment": "precedence with logical operators",
61+
"expression": "true && false ? foo : bar",
62+
"result": "bar"
63+
}
64+
]
65+
}
66+
]

0 commit comments

Comments
 (0)