Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On MacOS, tests hangs. #274

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions src/tests/cbk_test.zig
Original file line number Diff line number Diff line change
Expand Up @@ -260,17 +260,19 @@ pub fn exec(
};
try tests.checkCases(js_env, &cases_cbk_setter_arg);

// cancel cbk
var cases_cbk_cancel = [_]tests.Case{
.{
.src =
\\let vv = 0;
\\const id = window.cbkAsync(() => {vv += 1}, 100);
\\window.cancel(id);
,
.ex = "undefined",
},
.{ .src = "vv", .ex = "0" },
};
try tests.checkCases(js_env, &cases_cbk_cancel);
if (tests.isCancelAvailable()) {
// cancel cbk
var cases_cbk_cancel = [_]tests.Case{
.{
.src =
\\let vv = 0;
\\const id = window.cbkAsync(() => {vv += 1}, 100);
\\window.cancel(id);
,
.ex = "undefined",
},
.{ .src = "vv", .ex = "0" },
};
try tests.checkCases(js_env, &cases_cbk_cancel);
}
}
7 changes: 7 additions & 0 deletions src/tests/test_utils.zig
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ pub fn checkCasesAlloc(allocator: std.mem.Allocator, js_env: *public.Env, cases:
}
}

pub fn isCancelAvailable() bool {
return switch (@import("builtin").target.os.tag) {
.macos, .tvos, .watchos, .ios => false,
else => true,
};
}

pub const Case = struct {
src: []const u8,
ex: []const u8,
Expand Down