summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNicolas Williams <nico@cryptonector.com>2017-03-15 01:07:37 -0500
committerNicolas Williams <nico@cryptonector.com>2017-03-15 01:07:37 -0500
commitb142d484d58696e7e5be33b196d131169a032a76 (patch)
tree1f153e5b286fa991948cfba1716110e7a7b5a15f /tests
parent674e9fb7c29584f6591340a26e2e6156b1ed2c99 (diff)
Conditional exprs are not path exprs (fix #1368)
The conditional expression in if-then-elif-else-end cannot contribute to path expressions because it doesn't change the input to any of the then/ elif/else expressions. These must be generated via gen_subexp(). See also #1366.
Diffstat (limited to 'tests')
-rw-r--r--tests/jq.test5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/jq.test b/tests/jq.test
index 963595b0..ac784ef8 100644
--- a/tests/jq.test
+++ b/tests/jq.test
@@ -1382,4 +1382,9 @@ true
{"a":null,"b":null}
{"a":null,"b":"b"}
+# Regression test for #1368
+(.. | select(type == "object" and has("b") and (.b | type) == "array")|.b) |= .[0]
+{"a": {"b": [1, {"b": 3}]}}
+{"a": {"b": 1}}
+