summaryrefslogtreecommitdiffhomepage
path: root/tests/custom/03_stdlib/04_exit
blob: 1f941d1251394b1d5cfbbe5296660be75acfb083 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
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 --