• source navigation  • diff markup  • identifier search  • freetext search  • 

Sources/ucode/tests/custom/03_stdlib/05_getenv

  1 The `getenv()` function returns the value of the given environment variable
  2 or `null` if either the given variable does not exist or if the given name
  3 argument is not a string.
  4 
  5 If the variable name argument is omitted, getenv() returns a dictionary
  6 containing all environment variables.
  7 
  8 -- Testcase --
  9 {%
 10         printf("%.J\n", [
 11                 getenv("TEST_VARIABLE"),
 12                 getenv("EMPTY_VARIABLE"),
 13                 getenv("THIS_LIKELY_DOES_NOT_EXIST"),
 14                 getenv(123),
 15                 type(getenv())
 16         ]);
 17 %}
 18 -- End --
 19 
 20 -- Vars --
 21 TEST_VARIABLE=Test Value
 22 EMPTY_VARIABLE=
 23 -- End --
 24 
 25 -- Expect stdout --
 26 [
 27         "Test Value",
 28         "",
 29         null,
 30         null,
 31         "object"
 32 ]
 33 -- End --

This page was automatically generated by LXR 0.3.1.  •  OpenWrt