aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/test
diff options
context:
space:
mode:
authorMartin Hässler <[email protected]>2013-11-09 21:04:06 +0100
committerMartin Hässler <[email protected]>2013-11-09 21:04:06 +0100
commit7b739330bb459401f9c11f0f84912aedc7ee22cd (patch)
treee1ffbca9adb63a1132c6c8af8236b725a8c5da56 /erts/emulator/test
parent768a64354e3d69b3c0840a84dd072601c67ca39d (diff)
downloadotp-7b739330bb459401f9c11f0f84912aedc7ee22cd.tar.gz
otp-7b739330bb459401f9c11f0f84912aedc7ee22cd.tar.bz2
otp-7b739330bb459401f9c11f0f84912aedc7ee22cd.zip
Add os:unsetenv/1
New BIF os:unsetenv/1 which deletes an environment variable and returns 'true'. Does not change any old functionality. Calls the libc function unsetenv(3) on UNIX and SetEnvironmentVariableW(key, NULL) on Windows. The unicode support is the same as for os:getenv and os:putenv.
Diffstat (limited to 'erts/emulator/test')
-rw-r--r--erts/emulator/test/bif_SUITE.erl10
1 files changed, 7 insertions, 3 deletions
diff --git a/erts/emulator/test/bif_SUITE.erl b/erts/emulator/test/bif_SUITE.erl
index 02c6de8cb1..8b612a145c 100644
--- a/erts/emulator/test/bif_SUITE.erl
+++ b/erts/emulator/test/bif_SUITE.erl
@@ -388,8 +388,12 @@ os_env(Config) when is_list(Config) ->
false -> ?line ok;
BadVal -> ?line ?t:fail(BadVal)
end,
- %% os:putenv and os:getenv currently uses a temp buf of size 1024
- %% for storing key+value
+ ?line true = os:putenv(EnvVar1, "mors"),
+ ?line true = os:unsetenv(EnvVar1),
+ ?line false = os:getenv(EnvVar1),
+ ?line true = os:unsetenv(EnvVar1), % unset unset variable
+ %% os:putenv, os:getenv and os:unsetenv currently use a temp
+ %% buffer of size 1024 for storing key+value
?line os_env_long(1010, 1030, "hej hopp").
os_env_long(Min, Max, _Value) when Min > Max ->
@@ -398,7 +402,7 @@ os_env_long(Min, Max, Value) ->
?line EnvVar = lists:duplicate(Min, $X),
?line true = os:putenv(EnvVar, Value),
?line Value = os:getenv(EnvVar),
- ?line true = os:putenv(EnvVar, ""),
+ ?line true = os:unsetenv(EnvVar),
?line os_env_long(Min+1, Max, Value).
otp_7526(doc) ->