aboutsummaryrefslogtreecommitdiff
path: root/std
diff options
context:
space:
mode:
authorSuirad <suirad@users.noreply.github.com>2018-11-30 02:15:33 -0600
committerSuirad <suirad@users.noreply.github.com>2018-11-30 02:15:33 -0600
commitcf266ff80a69d19140465b949350421dc541d4c8 (patch)
tree1bfd6b7b257bad8e77d4917e53c17ab56cce15a2 /std
parente8e6ae57d41fdcdb4027ae95c04ad7aeea4a7aac (diff)
downloadzig-cf266ff80a69d19140465b949350421dc541d4c8.tar.gz
zig-cf266ff80a69d19140465b949350421dc541d4c8.zip
Update tests
Diffstat (limited to 'std')
-rw-r--r--std/os/index.zig31
1 files changed, 3 insertions, 28 deletions
diff --git a/std/os/index.zig b/std/os/index.zig
index d298ff4329..779fa8f8c8 100644
--- a/std/os/index.zig
+++ b/std/os/index.zig
@@ -772,27 +772,7 @@ pub fn getEnvMap(allocator: *Allocator) !BufMap {
test "os.getEnvMap" {
var env = try getEnvMap(std.debug.global_allocator);
- var seen_home = false;
- var it = env.iterator();
- while (it.next()) |pair| {
- debug.warn("{}: {}\n", pair.key, pair.value);
- switch (builtin.os){
- builtin.Os.windows => {
- if (mem.eql(u8, pair.key, "HOMEPATH")) {
- seen_home = true;
- }
- },
- builtin.Os.linux, builtin.Os.macosx,
- builtin.Os.ios => {
- if (mem.eql(u8, pair.key, "HOME")) {
- seen_home = true;
- }
- },
- else => @compileError("unimplemented"),
- }
- }
-
- assert(seen_home == true);
+ defer env.deinit();
}
/// TODO make this go through libc when we have it
@@ -862,13 +842,8 @@ pub fn getEnvVarOwned(allocator: *mem.Allocator, key: []const u8) GetEnvVarOwned
}
test "os.getEnvVarOwned" {
- switch (builtin.os) {
- builtin.Os.windows => _ = try getEnvVarOwned(debug.global_allocator, "HOMEPATH"),
-
- builtin.Os.linux, builtin.Os.macosx,
- builtin.Os.ios => _ = try getEnvVarOwned(debug.global_allocator, "HOME"),
- else => @compileError("unimplemented"),
- }
+ var ga = debug.global_allocator;
+ debug.assertError(getEnvVarOwned(ga, "BADENV"), error.EnvironmentVariableNotFound);
}