Skip to content

Commit

Permalink
Add "coverage" Makefile target for lcov.info, add a test that extends…
Browse files Browse the repository at this point in the history
… coverage
  • Loading branch information
graydon committed Sep 5, 2023
1 parent 243a362 commit bbf77d6
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,8 @@ publish:

publish-dry-run:
./publish-dry-run.sh

# Requires: cargo-install llvm-cov
coverage:
rm -f lcov.info
cargo llvm-cov test --all-features --tests --lcov --output-path=lcov.info
17 changes: 17 additions & 0 deletions soroban-env-host/src/events/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,3 +177,20 @@ impl Host {
})
}
}

#[test]
fn misc_coverage() -> Result<(), HostError> {
use crate::xdr::HostFunctionType;
let host = Host::default();

// cover get_current_contract_id_unmetered on HostFunctionType::InvokeContract
host.with_frame(
Frame::HostFunction(HostFunctionType::InvokeContract),
|| {
assert_eq!(host.get_current_contract_id_unmetered()?, None);
Ok(Val::VOID.into())
},
)?;

Ok(())
}

0 comments on commit bbf77d6

Please sign in to comment.