summaryrefslogtreecommitdiffhomepage
path: root/tests/custom/03_stdlib/48_b64dec
blob: 898aa7acae3106ada00f7bba7ede3771a0f7d35e (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
The `b64dec()` function decodes the given base64 input string.

Returns a string containing the decoded data.

Returns `null` if the input is not a string or if the input string was
invalid base64 data (e.g. missing padding or non-whitespace characters
outside the expected alphabet).

-- Testcase --
{%
	printf("%.J\n", [
		b64dec("SGVsbG8sIHdvcmxkIQ=="),
		b64dec("SGVsbG8sIHdvcmxkIQ"),
		b64dec("AAECAw=="),
		b64dec("xxx"),
		b64dec("==="),
		b64dec(true)
	]);
%}
-- End --

-- Expect stdout --
[
	"Hello, world!",
	null,
	"\u0000\u0001\u0002\u0003",
	null,
	null,
	null
]
-- End --