| ... | @@ -772,27 +772,7 @@ pub fn getEnvMap(allocator: *Allocator) !BufMap { | ... | @@ -772,27 +772,7 @@ pub fn getEnvMap(allocator: *Allocator) !BufMap { |
| 772 | | 772 | |
| 773 | test "os.getEnvMap" { | 773 | test "os.getEnvMap" { |
| 774 | var env = try getEnvMap(std.debug.global_allocator); | 774 | var env = try getEnvMap(std.debug.global_allocator); |
| 775 | var seen_home = false; | 775 | defer env.deinit(); |
| 776 | var it = env.iterator(); | | |
| 777 | while (it.next()) |pair| { | | |
| 778 | debug.warn("{}: {}\n", pair.key, pair.value); | | |
| 779 | switch (builtin.os){ | | |
| 780 | builtin.Os.windows => { | | |
| 781 | if (mem.eql(u8, pair.key, "HOMEPATH")) { | | |
| 782 | seen_home = true; | | |
| 783 | } | | |
| 784 | }, | | |
| 785 | builtin.Os.linux, builtin.Os.macosx, | | |
| 786 | builtin.Os.ios => { | | |
| 787 | if (mem.eql(u8, pair.key, "HOME")) { | | |
| 788 | seen_home = true; | | |
| 789 | } | | |
| 790 | }, | | |
| 791 | else => @compileError("unimplemented"), | | |
| 792 | } | | |
| 793 | } | | |
| 794 | | | |
| 795 | assert(seen_home == true); | | |
| 796 | } | 776 | } |
| 797 | | 777 | |
| 798 | /// TODO make this go through libc when we have it | 778 | /// TODO make this go through libc when we have it |
| ... | @@ -862,13 +842,8 @@ pub fn getEnvVarOwned(allocator: *mem.Allocator, key: []const u8) GetEnvVarOwned | ... | @@ -862,13 +842,8 @@ pub fn getEnvVarOwned(allocator: *mem.Allocator, key: []const u8) GetEnvVarOwned |
| 862 | } | 842 | } |
| 863 | | 843 | |
| 864 | test "os.getEnvVarOwned" { | 844 | test "os.getEnvVarOwned" { |
| 865 | switch (builtin.os) { | 845 | var ga = debug.global_allocator; |
| 866 | builtin.Os.windows => _ = try getEnvVarOwned(debug.global_allocator, "HOMEPATH"), | 846 | debug.assertError(getEnvVarOwned(ga, "BADENV"), error.EnvironmentVariableNotFound); |
| 867 | | | |
| 868 | builtin.Os.linux, builtin.Os.macosx, | | |
| 869 | builtin.Os.ios => _ = try getEnvVarOwned(debug.global_allocator, "HOME"), | | |
| 870 | else => @compileError("unimplemented"), | | |
| 871 | } | | |
| 872 | } | 847 | } |
| 873 | | 848 | |
| 874 | | 849 | |