summaryrefslogtreecommitdiffhomepage
path: root/tests/custom/03_stdlib/04_exit
diff options
context:
space:
mode:
Diffstat (limited to 'tests/custom/03_stdlib/04_exit')
-rw-r--r--tests/custom/03_stdlib/04_exit36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/custom/03_stdlib/04_exit b/tests/custom/03_stdlib/04_exit
new file mode 100644
index 0000000..1f941d1
--- /dev/null
+++ b/tests/custom/03_stdlib/04_exit
@@ -0,0 +1,36 @@
+The `exit()` function terminates the running program with the given exit
+code or 0 in case no argument is given or if the argument cannot be
+converted to an integer.
+
+The function does not return.
+
+-- Testcase --
+{%
+ print("Before invoking exit()\n");
+
+ exit();
+
+ print("After invoking exit()\n");
+%}
+-- End --
+
+-- Expect stdout --
+Before invoking exit()
+-- End --
+
+-- Expect exitcode --
+0
+-- End --
+
+
+Passing a code argument overrides the default "0" value.
+
+-- Testcase --
+{%
+ exit(123)
+%}
+-- End --
+
+-- Expect exitcode --
+123
+-- End --