Skip to content

Commit

Permalink
test: Fix tests for ErrorKind
Browse files Browse the repository at this point in the history
  • Loading branch information
sorairolake committed Dec 10, 2024
1 parent 29518a4 commit 8d75ac1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ Enables features that depend on the nightly Rust.

#### `extended_io_error`

Enables features that depend on the `io_error_more` feature. This also enables
`std`. This is implied by `nightly`.
Enables features that depend on the `io_error_inprogress` and the
`io_error_more` features. This also enables `std`. This is implied by `nightly`.

### `no_std` support

Expand Down
11 changes: 9 additions & 2 deletions src/exit_code/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ mod tests {
);
#[cfg(feature = "extended_io_error")]
assert_eq!(
ExitCode::from(Error::from(ErrorKind::FilesystemQuotaExceeded)),
ExitCode::from(Error::from(ErrorKind::QuotaExceeded)),
ExitCode::IoErr
);
#[cfg(feature = "extended_io_error")]
Expand Down Expand Up @@ -813,6 +813,11 @@ mod tests {
ExitCode::from(Error::from(ErrorKind::OutOfMemory)),
ExitCode::OsErr
);
#[cfg(feature = "extended_io_error")]
assert_eq!(
ExitCode::from(Error::from(ErrorKind::InProgress)),
ExitCode::IoErr
);
assert_eq!(
ExitCode::from(Error::from(ErrorKind::Other)),
ExitCode::IoErr
Expand Down Expand Up @@ -926,7 +931,7 @@ mod tests {
assert_eq!(ExitCode::from(io::ErrorKind::NotSeekable), ExitCode::IoErr);
#[cfg(feature = "extended_io_error")]
assert_eq!(
ExitCode::from(io::ErrorKind::FilesystemQuotaExceeded),
ExitCode::from(io::ErrorKind::QuotaExceeded),
ExitCode::IoErr
);
#[cfg(feature = "extended_io_error")]
Expand Down Expand Up @@ -970,6 +975,8 @@ mod tests {
ExitCode::Software
);
assert_eq!(ExitCode::from(io::ErrorKind::OutOfMemory), ExitCode::OsErr);
#[cfg(feature = "extended_io_error")]
assert_eq!(ExitCode::from(io::ErrorKind::InProgress), ExitCode::IoErr);
assert_eq!(ExitCode::from(io::ErrorKind::Other), ExitCode::IoErr);
}

Expand Down
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
//!
//! [`<sysexits.h>`]: https://man.openbsd.org/sysexits
#![cfg_attr(feature = "extended_io_error", feature(io_error_more))]
#![cfg_attr(
feature = "extended_io_error",
feature(io_error_inprogress, io_error_more)
)]
#![doc(html_root_url = "https://docs.rs/sysexits/0.8.5/")]
#![no_std]
#![cfg_attr(docsrs, feature(doc_auto_cfg, doc_cfg))]
Expand Down

0 comments on commit 8d75ac1

Please sign in to comment.