From cc1ecd1996eb25bc3abdc40093f0337911b74e61 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Thu, 27 Jun 2019 02:27:54 +0200 Subject: [PATCH] Revert "add `unsetenv`, `setenv`, `clearenv` to os module (#583)" This reverts commit 6cb5eee1b2e67f2e77e62ff9e7e845aa82a62183. --- os/os.v | 18 ------------------ os/os_test.v | 26 -------------------------- 2 files changed, 44 deletions(-) delete mode 100644 os/os_test.v diff --git a/os/os.v b/os/os.v index 06a7a470df..61ab53e0a9 100644 --- a/os/os.v +++ b/os/os.v @@ -316,24 +316,6 @@ pub fn getenv(key string) string { return tos2(s) } - -pub fn setenv(name string, value string, overwrite bool) int { - return C.setenv(name.cstr(), value.cstr(), overwrite) -} - -pub fn unsetenv(name string) int { - return C.unsetenv(name.cstr()) -} - -pub fn clearenv() { - C.clearenv() -} - -fn exit(code int) { - C.exit(code) -} - - // `file_exists` returns true if `path` exists. pub fn file_exists(path string) bool { res := false diff --git a/os/os_test.v b/os/os_test.v deleted file mode 100644 index e382bbd875..0000000000 --- a/os/os_test.v +++ /dev/null @@ -1,26 +0,0 @@ -import os - -fn test_setenv() { - os.setenv('foo', 'bar', true) - assert os.getenv('foo') == 'bar' - - // `setenv` should not set if `overwrite` is false - os.setenv('foo', 'bar2', false) - assert os.getenv('foo') == 'bar' - - // `setenv` should overwrite if `overwrite` is true - os.setenv('foo', 'bar2', true) - assert os.getenv('foo') == 'bar2' -} - -fn test_unsetenv() { - os.setenv('foo', 'bar', true) - os.unsetenv('foo') - assert os.getenv('foo') == '' -} - -fn test_clearenv() { - os.setenv('foo', 'bar', true) - os.clearenv() - assert os.getenv('foo') == '' -}