From c32a46815e097330214c99f1af15974d88a9244e Mon Sep 17 00:00:00 2001 From: owl Date: Sat, 14 Oct 2023 11:26:56 +0200 Subject: [PATCH] try to test on "windows" --- build.zig | 3 +++ src/main.zig | 15 +++++++++++++++ x.sh | 4 ++++ 3 files changed, 22 insertions(+) diff --git a/build.zig b/build.zig index 776fdc7..e695f45 100644 --- a/build.zig +++ b/build.zig @@ -56,6 +56,9 @@ pub fn build(b: *std.Build) void { .optimize = optimize, }); + if (target.os_tag == .windows) + b.enable_wine = true; + unit_tests.addModule("ziglyph", ziglyph.module("ziglyph")); unit_tests.addOptions("build-options", build_opts); diff --git a/src/main.zig b/src/main.zig index 3d37fd2..b268f53 100644 --- a/src/main.zig +++ b/src/main.zig @@ -345,6 +345,21 @@ test "it counts grapheme clusters correctly" { } } +test "term width on windows?" { + const win = std.os.windows; + + const w = getTermWidth() catch { + const eno = win.kernel32.GetLastError(); + _ = eno; + //std.log.err("last error: {d}", .{eno}); + // return err; + return; + }; + _ = w; + + //try testing.expect(0 < w); +} + test "leading zeros" { // this works with `atoi`, `strtol`, and also in zig, // and in every tested terminal emulator. diff --git a/x.sh b/x.sh index fcde953..75ad7d8 100755 --- a/x.sh +++ b/x.sh @@ -9,6 +9,10 @@ build_for_arch_and_os() { rmdir "$out/$2/$1/bin" } +test_for_arch_and_os() { + zig build test -Dtarget="$1-$2" +} + for a in aarch64 arm riscv64 powerpc64 powerpc64le x86_64 x86; do build_for_arch_and_os $a linux done -- 2.45.2