summaryrefslogtreecommitdiffhomepage
path: root/tests/custom/03_stdlib/02_die
diff options
context:
space:
mode:
Diffstat (limited to 'tests/custom/03_stdlib/02_die')
-rw-r--r--tests/custom/03_stdlib/02_die49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/custom/03_stdlib/02_die b/tests/custom/03_stdlib/02_die
new file mode 100644
index 0000000..344069a
--- /dev/null
+++ b/tests/custom/03_stdlib/02_die
@@ -0,0 +1,49 @@
+The `die()` function triggers a user defined runtime exception when invoked,
+using the given value as exception message.
+
+The given message value is converted to a string internally if it is not a
+string already. If no message argument is given or if the message argument
+is `null`, the default message is `Died`.
+
+The function does not return.
+
+-- Testcase --
+{%
+ print("Before invoking die()\n");
+
+ die("An exception!");
+
+ print("After invoking die()\n");
+%}
+-- End --
+
+-- Expect stdout --
+Before invoking die()
+-- End --
+
+-- Expect stderr --
+An exception!
+In line 4, byte 21:
+
+ ` die("An exception!");`
+ Near here -------------^
+
+
+-- End --
+
+
+-- Testcase --
+{%
+ die();
+%}
+-- End --
+
+-- Expect stderr --
+Died
+In line 2, byte 6:
+
+ ` die();`
+ ^-- Near here
+
+
+-- End --