diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 03dc7e1..0b50578 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,11 +8,8 @@ on: jobs: test-disabling-macros: - name: Tests (2.8.5) - support for disabling macros - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ ubuntu-latest, windows-latest ] + name: Tests 2.8.5 - windows + runs-on: windows-latest steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable @@ -27,7 +24,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - version: [2.9.1, 2.10.1] + version: [2.8.5, 2.9.1, 2.10.1, 2.11.0] steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@stable @@ -37,7 +34,12 @@ jobs: with: scarb-version: ${{ matrix.version }} - uses: foundry-rs/setup-snfoundry@ee00ea3f026379008ca40a54448d4059233d06cc # v4.0.0 + - run: cargo test --features allows-excluding-macros allows-including-test-functions + if: matrix.version == '2.8.5' - run: cargo test --release + if: matrix.version == '2.9.1' || matrix.version == '2.10.1' + - run: cargo test --features allows-excluding-macros + if: matrix.version == '2.11.0' rustfmt: name: Check rust formatting diff --git a/crates/cairo-coverage/Cargo.toml b/crates/cairo-coverage/Cargo.toml index 9552271..7335609 100644 --- a/crates/cairo-coverage/Cargo.toml +++ b/crates/cairo-coverage/Cargo.toml @@ -22,3 +22,4 @@ which.workspace = true [features] allows-excluding-macros = [] +allows-including-test-functions = [] diff --git a/crates/cairo-coverage/src/commands/run.rs b/crates/cairo-coverage/src/commands/run.rs index 6de0ebc..e21737e 100644 --- a/crates/cairo-coverage/src/commands/run.rs +++ b/crates/cairo-coverage/src/commands/run.rs @@ -21,9 +21,17 @@ pub fn run( let metadata = scarb_metadata()?; if !include.contains(&IncludedComponent::Macros) { + ensure!( + metadata.app_version_info.version <= Version::new(2, 8, 5) + || metadata.app_version_info.version >= Version::new(2, 11, 0), + "excluding macros is only supported for Scarb versions <= 2.8.5 and >= 2.11.0" + ); + } + + if include.contains(&IncludedComponent::TestFunctions) { ensure!( metadata.app_version_info.version <= Version::new(2, 8, 5), - "excluding macros is only supported for Scarb versions <= 2.8.5" + "including test functions is only supported for Scarb versions <= 2.8.5" ); } diff --git a/crates/cairo-coverage/tests/e2e/general.rs b/crates/cairo-coverage/tests/e2e/general.rs index 9c162e3..d47db39 100644 --- a/crates/cairo-coverage/tests/e2e/general.rs +++ b/crates/cairo-coverage/tests/e2e/general.rs @@ -9,7 +9,7 @@ fn simple() { } #[test] -#[cfg(feature = "allows-excluding-macros")] +#[cfg(feature = "allows-including-test-functions")] fn simple_with_tests() { TestProject::new("simple") .coverage_args(&["--unstable", "--include", "test-functions"])