summaryrefslogtreecommitdiffhomepage
path: root/tests/custom/03_stdlib/37_warn
blob: 2c0ff24cb053fdcf20b79bbd147464255723c0f0 (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
The `warn()` function outputs the given values to stderr.

Returns the amount of bytes written.

-- Testcase --
{%
	let n = 0;

	n += warn(null, "\n");
	n += warn(true, "\n");
	n += warn(false, "\n");
	n += warn(123, "\n");
	n += warn(456.789, "\n");
	n += warn(NaN, "\n");
	n += warn(Infinity, "\n");
	n += warn("Hello world", "\n");
	n += warn([ 1, 2, 3 ], "\n");
	n += warn({ some: "dict" }, "\n");
	n += warn(warn, "\n");

	warn(n, " bytes written\n");
%}
-- End --

-- Expect stderr --

true
false
123
456.789
NaN
Infinity
Hello world
[ 1, 2, 3 ]
{ "some": "dict" }
function warn(...) { [native code] }
117 bytes written
-- End --