mirror of
https://github.com/rust-vmm/rust-vmm-ci.git
synced 2026-08-05 03:08:31 +00:00
Add Rust unittest so that test_coverage properly self-tests
Using kcov, a coverage of 33.3% was reported, even though that are no rust-test code in the dummy crate that is included in this repository. This commit adds an actual unit test, so that the test_coverage test actually properly self-tests here. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"coverage_score": 33.3,
|
"coverage_score": 100.0,
|
||||||
"exclude_path": "",
|
"exclude_path": "",
|
||||||
"crate_features": ""
|
"crate_features": ""
|
||||||
}
|
}
|
||||||
|
|||||||
12
src/lib.rs
12
src/lib.rs
@@ -1,3 +1,11 @@
|
|||||||
pub fn main() {
|
pub fn add(a: u32, b: u32) -> u32 {
|
||||||
println!("It works!");
|
a + b
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
#[test]
|
||||||
|
fn test_add() {
|
||||||
|
assert_eq!(super::add(1, 2), 3)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user