Skip to content

Commit

Permalink
coverall: a unit-test instead of ignoring error.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
fadeevab committed May 26, 2024
1 parent 2ed048b commit 28be28f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
run: |
mkdir coverage
./grcov ./target/debug/ -s . -t lcov --llvm --branch --ignore-not-existing \
--ignore "/*" --ignore "src/error.rs" \
--ignore "/*" \
--excl-line '#\[|=> panic!|unreachable!|Io\(std::io::Error\)|//!|///|^[ }]*$' \
--excl-br-line '#\[|=> panic!|unreachable!|assert_..!|//!|///' -o ./coverage/lcov.info
- name: Send to Coveralls
Expand Down
14 changes: 14 additions & 0 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,17 @@ impl From<std::io::Error> for Error {
}
}
}

#[cfg(test)]
mod test {
use super::Error;

#[test]
fn test_error() {
let err: Error = std::io::Error::from(std::io::ErrorKind::UnexpectedEof).into();
match err {
Error::TooShort => (),
_ => panic!("Unexpected error: not TooShort"),
}
}
}

0 comments on commit 28be28f

Please sign in to comment.