summaryrefslogtreecommitdiffhomepage
path: root/tests/custom/03_stdlib/05_getenv
blob: 350e95294c0db34954e204426a92491d6fea433e (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
The `getenv()` function returns the value of the given environment variable
or `null` if either the given variable does not exist or if the given name
argument is not a string.

-- Testcase --
{%
	printf("%.J\n", [
		getenv("TEST_VARIABLE"),
		getenv("EMPTY_VARIABLE"),
		getenv("THIS_LIKELY_DOES_NOT_EXIST"),
		getenv(123),
		getenv(null)
	]);
%}
-- End --

-- Vars --
TEST_VARIABLE=Test Value
EMPTY_VARIABLE=
-- End --

-- Expect stdout --
[
	"Test Value",
	"",
	null,
	null,
	null
]
-- End --