Skip to content
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
14 changes: 8 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
1 change: 1 addition & 0 deletions crates/cairo-coverage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ which.workspace = true

[features]
allows-excluding-macros = []
allows-including-test-functions = []
10 changes: 9 additions & 1 deletion crates/cairo-coverage/src/commands/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
);
}

Expand Down
2 changes: 1 addition & 1 deletion crates/cairo-coverage/tests/e2e/general.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down
Loading