Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpedda committed Oct 13, 2024
1 parent 54acad7 commit 87e3d8b
Show file tree
Hide file tree
Showing 15 changed files with 611 additions and 590 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,5 +150,6 @@ jobs:
run: rustup toolchain install nightly --profile minimal
- name: Build
run: |
cargo generate-lockfile
cargo +nightly update -Z minimal-versions
cargo build ${{ matrix.features.features }} --target ${{ matrix.target }}
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1"
serde_test = "1"
static_assertions = "1"
wasm-bindgen-test = "0.3"

[target.'cfg(not(target_family = "wasm"))'.dev-dependencies]
pollster = { version = "0.3", features = ["macro"] }
Expand All @@ -35,7 +36,6 @@ pollster = { version = "0.3", features = ["macro"] }
getrandom = { version = "0.2", features = ["js"] }
rand = "0.8"
wasm-bindgen-futures = "0.4"
wasm-bindgen-test = "0.3"
web-sys = { version = "0.3", features = [
"CssStyleDeclaration",
"Document",
Expand All @@ -56,6 +56,8 @@ web-thread = { git = "https://github.com/daxpedda/wasm-worker", rev = "93236ab92

[patch.crates-io]
pollster = { git = "https://github.com/zesterer/pollster", rev = "58f420e1ac19def81183ca4140470e4bb956fd11" }
wasm-bindgen-test = { git = "https://github.com/daxpedda/wasm-bindgen", branch = "web-time" }
wasm-bindgen-test-macro = { git = "https://github.com/daxpedda/wasm-bindgen", branch = "web-time" }

[profile.bench]
codegen-units = 1
Expand Down
2 changes: 2 additions & 0 deletions tests/atomic_failure.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Run tests with the atomics target feature.
#![cfg(test)]
#![cfg(all(target_family = "wasm", target_feature = "atomics"))]

Expand Down
2 changes: 2 additions & 0 deletions tests/atomic_success.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Run tests with the atomics target feature.
#![cfg(test)]
#![cfg(all(target_family = "wasm", target_feature = "atomics"))]

Expand Down
44 changes: 24 additions & 20 deletions tests/instant_failure_1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,32 @@

mod util;

use wasm_bindgen_test::wasm_bindgen_test;
use web_time::{Duration, Instant};

use self::util::{sleep, DIFF};

test! {
/// [`Instant::add()`] failure.
#[should_panic = "overflow when adding duration to instant"]
async fn add_failure() {
sleep(DIFF).await;
let _ = Instant::now() + Duration::MAX;
}

/// [`Instant::sub()`] failure.
#[should_panic = "overflow when subtracting duration from instant"]
async fn sub_failure() {
let _ = Instant::now() - Duration::MAX;
}

/// [`Instant::sub_assign()`] failure.
#[should_panic = "overflow when subtracting duration from instant"]
async fn sub_assign_failure() {
let mut instant = Instant::now();
instant -= Duration::MAX;
}
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);

/// [`Instant::add()`] failure.
#[wasm_bindgen_test(unsupported = pollster::test)]
#[should_panic = "overflow when adding duration to instant"]
async fn add_failure() {
sleep(DIFF).await;
let _ = Instant::now() + Duration::MAX;
}

/// [`Instant::sub()`] failure.
#[wasm_bindgen_test(unsupported = test)]
#[should_panic = "overflow when subtracting duration from instant"]
fn sub_failure() {
let _ = Instant::now() - Duration::MAX;
}

/// [`Instant::sub_assign()`] failure.
#[wasm_bindgen_test(unsupported = test)]
#[should_panic = "overflow when subtracting duration from instant"]
fn sub_assign_failure() {
let mut instant = Instant::now();
instant -= Duration::MAX;
}
18 changes: 10 additions & 8 deletions tests/instant_failure_2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,18 @@

mod util;

use wasm_bindgen_test::wasm_bindgen_test;
use web_time::{Duration, Instant};

use self::util::{sleep, DIFF};

test! {
/// [`Instant::add_assign()`] failure.
#[should_panic = "overflow when adding duration to instant"]
async fn add_assign_failure() {
sleep(DIFF).await;
let mut instant = Instant::now();
instant += Duration::MAX;
}
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);

/// [`Instant::add_assign()`] failure.
#[wasm_bindgen_test(unsupported = pollster::test)]
#[should_panic = "overflow when adding duration to instant"]
async fn add_assign_failure() {
sleep(DIFF).await;
let mut instant = Instant::now();
instant += Duration::MAX;
}
Loading

0 comments on commit 87e3d8b

Please sign in to comment.