1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

os: implement os.environ() (part 2/2) (#3971)

This commit is contained in:
Delyan Angelov
2020-03-10 15:25:16 +02:00
committed by GitHub
parent 877b474fe1
commit 7036ca55e6
4 changed files with 116 additions and 61 deletions

View File

@ -8,25 +8,6 @@ fn testsuite_end() {
cleanup_leftovers()
}
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_open_file() {
filename := './test1.txt'
hello := 'hello world!'