diff --git a/Makefile b/Makefile index 0211ae5c7..7ddfca70e 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/soroban-env-host/src/events/diagnostic.rs b/soroban-env-host/src/events/diagnostic.rs index efef2f28b..da16b977c 100644 --- a/soroban-env-host/src/events/diagnostic.rs +++ b/soroban-env-host/src/events/diagnostic.rs @@ -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(()) +}