Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bzip2.rs: improve test coverage #31

Merged
merged 15 commits into from
Nov 12, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
env:
RUST_BACKTRACE: 1
- name: cargo test with llvm-cov
run: cargo llvm-cov --target ${{matrix.target}} ${{ matrix.features }} --lcov --output-path lcov.info --ignore-filename-regex "bzip2\.rs|test-libbzip2" --workspace
run: cargo llvm-cov --target ${{matrix.target}} ${{ matrix.features }} --lcov --output-path lcov.info --ignore-filename-regex "test-libbzip2" --workspace
env:
RUST_BACKTRACE: 1
if: matrix.os != 'windows-2022'
Expand Down
10 changes: 6 additions & 4 deletions bzip2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@
} else {
if noisy {
eprintln!(
"{}: {}: trailing garbage after EOF ignored\n",
"\n{}: {}: trailing garbage after EOF ignored\n",
CStr::from_ptr(progName).to_string_lossy(),
CStr::from_ptr(inName.as_ptr()).to_string_lossy(),
);
Expand Down Expand Up @@ -856,13 +856,14 @@
}

unsafe fn configError() -> ! {
eprint!(concat!(
const MSG: &str = concat!(
"bzip2: I'm not configured correctly for this platform!\n",
"\tI require Int32, Int16 and Char to have sizes\n",
"\tof 4, 2 and 1 bytes to run properly, and they don't.\n",
"\tProbably you can fix this by defining them correctly,\n",
"\tand recompiling. Bye!\n",
));
);
eprint!("{}", MSG);

Check warning on line 866 in bzip2.rs

View check run for this annotation

Codecov / codecov/patch

bzip2.rs#L866

Added line #L866 was not covered by tests
setExit(3 as libc::c_int);
exit(exitValue);
}
Expand Down Expand Up @@ -1513,12 +1514,13 @@
outStr = stdout;
if inStr.is_null() {
eprintln!(
"{}: Can't open input file {}:{}.",
"{}: Can't open input file {}: {}.",
get_program_name().display(),
in_name.display(),
display_last_os_error(),
);
if !inStr.is_null() {
// this is unreachable, but it exists in the original C source code

Check warning on line 1523 in bzip2.rs

View check run for this annotation

Codecov / codecov/patch

bzip2.rs#L1523

Added line #L1523 was not covered by tests
fclose(inStr);
}
setExit(1);
Expand Down
Loading
Loading