summaryrefslogtreecommitdiffstats
path: root/pigeonhole/tests/compile/errors/if.sieve
diff options
context:
space:
mode:
Diffstat (limited to 'pigeonhole/tests/compile/errors/if.sieve')
-rw-r--r--pigeonhole/tests/compile/errors/if.sieve78
1 files changed, 78 insertions, 0 deletions
diff --git a/pigeonhole/tests/compile/errors/if.sieve b/pigeonhole/tests/compile/errors/if.sieve
new file mode 100644
index 0000000..6a8537b
--- /dev/null
+++ b/pigeonhole/tests/compile/errors/if.sieve
@@ -0,0 +1,78 @@
+/*
+ * If command errors
+ *
+ * Total errors: 11 (+1 = 12)
+ */
+
+# Spurious argument
+if "frop" true {}
+
+# Spurious argument
+elsif "frop" true {}
+
+# Spurious string list
+if [ "false", "false", "false" ] false {
+ stop;
+}
+
+# No block
+if true;
+
+# No test
+if {
+ keep;
+}
+
+# Spurious test list
+if ( false, false, true ) {
+ keep;
+}
+
+stop;
+
+# If-less else
+else {
+ keep;
+}
+
+# Not an error
+if true {
+ keep;
+}
+
+stop;
+
+# If-less if structure (should produce only one error)
+elsif true {
+ keep;
+}
+elsif true {
+ keep;
+}
+else {
+}
+
+# Elsif after else
+if true {
+ keep;
+} else {
+ stop;
+} elsif true {
+ stop;
+}
+
+# If used as test
+if if true {
+}
+
+# Else if instead of elsif
+
+if true {
+ stop;
+} else if false {
+ keep;
+}
+
+
+
+