diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-01-29 23:31:16 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2022-02-03 17:22:43 +0100 |
commit | 7edad5cefa0f065aa83dffd2d7830aeaf9f38662 (patch) | |
tree | 86b727f434302ffb28cb59278243517f9765e170 /tests/custom/03_stdlib/05_getenv | |
parent | d5003fde57eab19588da7bfdbaefe93d47435eb6 (diff) |
tests: add functional tests for builtin functions
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'tests/custom/03_stdlib/05_getenv')
-rw-r--r-- | tests/custom/03_stdlib/05_getenv | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/custom/03_stdlib/05_getenv b/tests/custom/03_stdlib/05_getenv new file mode 100644 index 0000000..350e952 --- /dev/null +++ b/tests/custom/03_stdlib/05_getenv @@ -0,0 +1,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 -- |