more tests and docs

This commit is contained in:
sagie gur ari 2021-09-13 17:05:33 +00:00
parent 8cd03c3074
commit aeff46b0a5
3 changed files with 41 additions and 0 deletions

View file

@ -2539,6 +2539,17 @@ true if successful
```sh
set_env HOME /usr/me
handle = map
map_put ${handle} mapkey1 mapvalue1
map_put ${handle} mapkey2 mapvalue2
set_env --handle ${handle}
# load env file
text = readfile ./test.env
handle = map
map_load_properties ${handle} ${text}
set_env --handle ${handle}
```

View file

@ -23,4 +23,15 @@ true if successful
```sh
set_env HOME /usr/me
handle = map
map_put ${handle} mapkey1 mapvalue1
map_put ${handle} mapkey2 mapvalue2
set_env --handle ${handle}
# load env file
text = readfile ./test.env
handle = map
map_load_properties ${handle} ${text}
set_env --handle ${handle}
```

View file

@ -22,3 +22,22 @@ fn test_set_get_unset
release ${handle}
end
fn test_set_all_from_file
writefile ./target/_duckscript_test/vars_test/test.env envfile1=value1\nenvfile2=value2
text = readfile ./target/_duckscript_test/vars_test/test.env
handle = map
result = map_load_properties ${handle} ${text}
assert_eq ${result} true
value = set_env --handle ${handle}
assert ${value}
value = get_env envfile1
assert_eq ${value} value1
value = get_env envfile2
assert_eq ${value} value2
release ${handle}
end