summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNicolas Williams <nico@cryptonector.com>2014-07-05 20:54:42 -0500
committerNicolas Williams <nico@cryptonector.com>2014-07-06 01:29:42 -0500
commit7fce34292e33b967ca19003dd1baf90c0bc42b22 (patch)
treef9f4122e0e4e73885ca194fd1f3307dce68119a9 /tests
parent9113282c27be7c60fcf8fbfa1837d2f195a479b1 (diff)
Add `try EXP catch EXP`
Diffstat (limited to 'tests')
-rw-r--r--tests/all.test5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/all.test b/tests/all.test
index e50b9250..f5c7bd68 100644
--- a/tests/all.test
+++ b/tests/all.test
@@ -665,6 +665,11 @@ def inc(x): x |= .+1; inc(.[].a)
{}
[true, true, false]
+# Try/catch and general `?` operator
+[.[]|try if . == 0 then error("foo") elif . == 1 then .a elif . == 2 then empty else . end catch .]
+[0,1,2,3]
+["foo","Cannot index number with string \"a\"",3]
+
# string operations
[.[]|startswith("foo")]
["fo", "foo", "barfoo", "foobar", "barfoob"]