summaryrefslogtreecommitdiffhomepage
path: root/tests/custom/03_stdlib/02_die
blob: 344069aa709c8fc1a9d1b523a156ff61fd12d25c (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
37
38
39
40
41
42
43
44
45
46
47
48
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 --