mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 20:11:17 +00:00
17 lines
361 B
C
17 lines
361 B
C
module std::os::env @test;
|
|
|
|
fn void! set_get_unset()
|
|
{
|
|
const NAME = "C3_TEST_ENVVAR";
|
|
const VALUE = "foobar";
|
|
|
|
env::set_var(NAME, VALUE);
|
|
String v = env::get_var(NAME)!;
|
|
assert(v == VALUE, "got %s; want %s", v, VALUE);
|
|
|
|
env::clear_var(NAME);
|
|
if (try env::get_var(NAME))
|
|
{
|
|
assert(false, "environment variable should no longer exist");
|
|
}
|
|
} |