summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Dolan <mu@netsoc.tcd.ie>2012-09-16 11:07:36 +0100
committerStephen Dolan <mu@netsoc.tcd.ie>2012-09-16 11:07:36 +0100
commitcc2fb20ca03ca0cd30c0d9c768ead9b8cb7130f9 (patch)
treeae35533814dc408b0ceb529e70b35706c3c600d0
parentdf195b31873010f18883446c6e0e629a594badc5 (diff)
Hrm. Update operators (//=, +=, etc.) aren't very well thought out.
In complex cases, their behaviour is kinda weird. Here's a failing test for what I think they should do.
-rw-r--r--c/testdata7
1 files changed, 4 insertions, 3 deletions
diff --git a/c/testdata b/c/testdata
index e17f2bb7..a905d2af 100644
--- a/c/testdata
+++ b/c/testdata
@@ -312,9 +312,10 @@ def inc(x): x |= .+1; inc(.[].a)
[{"foo":[1,2], "bar": 42}, {"foo":[1], "bar": null}, {"foo":[null,false,3], "bar": 18}, {"foo":[], "bar":42}, {"foo": [null,false,null], "bar": 41}]
[[1,2], [1], [3], [42], [41]]
-.[] //= 42
-["hello",true,false,[false],null]
-["hello",true,42,[false],42]
+# FIXME: behaviour of update operators
+# .[] //= .[0]
+# ["hello",true,false,[false],null]
+# ["hello",true,"hello",[false],"hello"]
.[] | [.[0] and .[1], .[0] or .[1]]
[[true,[]], [false,1], [42,null], [null,false]]