summaryrefslogtreecommitdiffhomepage
path: root/tests/custom/03_stdlib/05_getenv
blob: 064add01f6ffeb6e113c76c61ed530e4682c511d (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
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.

If the variable name argument is omitted, getenv() returns a dictionary
containing all environment variables.

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

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

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