| ... | ... | @@ -775,15 +775,26 @@ pub fn getEnvMap(allocator: *Allocator) !BufMap { |
| 775 | 775 | |
| 776 | 776 | test "os.getEnvMap" { |
| 777 | 777 | var env = try getEnvMap(std.debug.global_allocator); |
| 778 | | var seen_path = false; |
| 778 | var seen_home = false; |
| 779 | 779 | var it = env.iterator(); |
| 780 | 780 | while (it.next()) |pair| { |
| 781 | | if (mem.eql(u8, pair.key, "PATH")) { |
| 782 | | seen_path = true; |
| 783 | | } |
| 781 | switch (builtin.os){ |
| 782 | builtin.Os.windows => { |
| 783 | if (mem.eql(u8, pair.key, "HOMEPATH")) { |
| 784 | seen_home = true; |
| 785 | } |
| 786 | }, |
| 787 | builtin.Os.linux, builtin.Os.macosx, |
| 788 | builtin.Os.ios => { |
| 789 | if (mem.eql(u8, pair.key, "HOME")) { |
| 790 | seen_home = true; |
| 791 | } |
| 792 | }, |
| 793 | else => @compileError("unimplemented"), |
| 794 | } |
| 784 | 795 | } |
| 785 | 796 | |
| 786 | | assert(seen_path == true); |
| 797 | assert(seen_home == true); |
| 787 | 798 | } |
| 788 | 799 | |
| 789 | 800 | /// TODO make this go through libc when we have it |
| ... | ... | @@ -854,8 +865,10 @@ pub fn getEnvVarOwned(allocator: *mem.Allocator, key: []const u8) GetEnvVarOwned |
| 854 | 865 | |
| 855 | 866 | test "os.getEnvVarOwned" { |
| 856 | 867 | switch (builtin.os) { |
| 857 | | builtin.Os.windows, builtin.Os.linux, builtin.Os.macosx, |
| 858 | | builtin.Os.ios => _ = try getEnvVarOwned(debug.global_allocator, "PATH"), |
| 868 | builtin.Os.windows => _ = try getEnvVarOwned(debug.global_allocator, "HOMEPATH"), |
| 869 | |
| 870 | builtin.Os.linux, builtin.Os.macosx, |
| 871 | builtin.Os.ios => _ = try getEnvVarOwned(debug.global_allocator, "HOME"), |
| 859 | 872 | else => @compileError("unimplemented"), |
| 860 | 873 | } |
| 861 | 874 | } |