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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

#### Changed
- macros are now by default included in the coverage report. If you want to exclude them, use the `--include` without the
`macros` option (can also have empty value)

## [0.4.0] - 2025-01-03

#### Added
Expand Down
2 changes: 1 addition & 1 deletion crates/cairo-coverage/src/args/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pub struct RunArgs {
pub output_path: Utf8PathBuf,

/// Include additional components in the coverage report.
#[arg(long, short, num_args = 1..)]
#[arg(long, short, num_args = 0.., default_value = "macros")]
pub include: Vec<IncludedComponent>,

/// Path to the project directory. If not provided, the project directory is inferred using `scarb metadata`.
Expand Down
10 changes: 9 additions & 1 deletion crates/cairo-coverage/tests/e2e/general.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ fn readme_example() {
#[test]
fn macros() {
TestProject::new("macros")
.coverage_args(&["--include", "macros"])
.run()
.output_same_as_in_file("macros.lcov");
}

#[test]
fn macros_not_included() {
TestProject::new("macros")
.coverage_args(&["--include"])
.run_without_genhtml()
.assert_empty_output();
}
Expand All @@ -72,3 +72,11 @@ fn snforge_template() {
.run()
.output_same_as_in_file("snforge_template.lcov");
}

#[test]
fn snforge_template_macros_not_included() {
TestProject::new("snforge_template")
.coverage_args(&["--include"])
.run()
.output_same_as_in_file("snforge_template_macros_not_included.lcov");
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,28 @@ FN:22,snforge_template::HelloStarknet::HelloStarknetImpl::get_balance
FNDA:9,snforge_template::HelloStarknet::HelloStarknetImpl::get_balance
FN:17,snforge_template::HelloStarknet::HelloStarknetImpl::increase_balance
FNDA:8,snforge_template::HelloStarknet::HelloStarknetImpl::increase_balance
FNF:2
FNH:2
FN:21,snforge_template::HelloStarknet::__wrapper__HelloStarknetImpl__get_balance
FNDA:27,snforge_template::HelloStarknet::__wrapper__HelloStarknetImpl__get_balance
FN:16,snforge_template::HelloStarknet::__wrapper__HelloStarknetImpl__increase_balance
FNDA:19,snforge_template::HelloStarknet::__wrapper__HelloStarknetImpl__increase_balance
FN:1,snforge_template::IHelloStarknetDispatcherImpl::get_balance
FNDA:16,snforge_template::IHelloStarknetDispatcherImpl::get_balance
FN:1,snforge_template::IHelloStarknetDispatcherImpl::increase_balance
FNDA:6,snforge_template::IHelloStarknetDispatcherImpl::increase_balance
FN:1,snforge_template::IHelloStarknetSafeDispatcherImpl::get_balance
FNDA:5,snforge_template::IHelloStarknetSafeDispatcherImpl::get_balance
FN:1,snforge_template::IHelloStarknetSafeDispatcherImpl::increase_balance
FNDA:3,snforge_template::IHelloStarknetSafeDispatcherImpl::increase_balance
FNF:8
FNH:8
DA:1,30
DA:16,19
DA:17,7
DA:18,8
DA:21,27
DA:22,9
LF:3
LH:3
LF:6
LH:6
end_of_record
TN:
SF:{dir}/tests/test_contract.cairo
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
TN:
SF:{dir}/src/lib.cairo
FN:22,snforge_template::HelloStarknet::HelloStarknetImpl::get_balance
FNDA:9,snforge_template::HelloStarknet::HelloStarknetImpl::get_balance
FN:17,snforge_template::HelloStarknet::HelloStarknetImpl::increase_balance
FNDA:8,snforge_template::HelloStarknet::HelloStarknetImpl::increase_balance
FNF:2
FNH:2
DA:17,7
DA:18,8
DA:22,9
LF:3
LH:3
end_of_record
TN:
SF:{dir}/tests/test_contract.cairo
FN:11,snforge_template_integrationtest::test_contract::deploy_contract
FNDA:10,snforge_template_integrationtest::test_contract::deploy_contract
FNF:1
FNH:1
DA:11,10
DA:12,10
LF:2
LH:2
end_of_record
Loading