| 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); |
| 3 | |
| 4 | pub fn build(b: *std.Build) void { |
| 5 | const test_step = b.step("test", "Test it"); |
| 6 | b.default_step = test_step; |
| 7 | |
| 8 | const optimize: std.builtin.Optimize = .debug; |
| 9 | |
| 10 | const main = b.addExecutable(.{ |
| 11 | .name = "main", |
| 12 | .root_module = b.createModule(.{ |
| 13 | .root_source_file = b.path("main.zig"), |
| 14 | .target = b.graph.host, |
| 15 | .optimize = optimize, |
| 16 | }), |
| 17 | }); |
| 18 | |
| 19 | const run = b.addRunArtifact(main); |
| 20 | run.clearEnvironment(); |
| 21 | run.setEnvironmentVariable("FOO", "123"); |
| 22 | run.setEnvironmentVariable("EQUALS", "ABC=123"); |
| 23 | run.setEnvironmentVariable("NO_VALUE", ""); |
| 24 | run.setEnvironmentVariable("КИРиллИЦА", "non-ascii አማርኛ \u{10FFFF}"); |
| 25 | if (b.graph.host.result.os.tag == .windows) { |
| 26 | run.setEnvironmentVariable("=Hidden", "hi"); |
| 27 | // \xed\xa0\x80 is a WTF-8 encoded unpaired surrogate code point |
| 28 | run.setEnvironmentVariable("INVALID_UTF16_\xed\xa0\x80", "\xed\xa0\x80"); |
| 29 | } |
| 30 | run.disable_zig_progress = true; |
| 31 | |
| 32 | test_step.dependOn(&run.step); |
| 33 | } |