Skip to content

Commit

Permalink
Make sure that pattern matching is exhaustive in tests (#503)
Browse files Browse the repository at this point in the history
  • Loading branch information
ia0 authored May 31, 2024
1 parent b4a798d commit eeeda7f
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/protocol/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

## 0.1.0-git

<!-- Increment to skip CHANGELOG.md test: 7 -->
<!-- Increment to skip CHANGELOG.md test: 8 -->
1 change: 1 addition & 0 deletions crates/protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ wasefire-error = { version = "0.1.1-git", path = "../error" }
wasefire-wire = { version = "0.1.0-git", path = "../wire" }

[features]
_exhaustive = []
full = []
std = ["wasefire-wire/std"]

Expand Down
2 changes: 1 addition & 1 deletion crates/protocol/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ macro_rules! api {
#[derive(Debug, Wire)]
#[wire(static = T)]
#[cfg_attr(feature = "full", wire(range = $next))]
#[non_exhaustive]
#[cfg_attr(not(feature = "_exhaustive"), non_exhaustive)]
pub enum Api<'a, T: Direction> {
$(
$(#[doc = $doc])* $(#[cfg($cfg)])* #[wire(tag = $tag)]
Expand Down
2 changes: 1 addition & 1 deletion crates/scheduler/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,4 @@

## 0.1.0

<!-- Increment to skip CHANGELOG.md test: 38 -->
<!-- Increment to skip CHANGELOG.md test: 39 -->
1 change: 1 addition & 0 deletions crates/scheduler/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ wasm = ["dep:wasefire-interpreter"]
# safety invariant.
unsafe-skip-validation = []
# Internal features.
_test = ["wasefire-protocol?/_exhaustive"]
internal-applet-api-crypto = []
internal-applet-api-crypto-hash = ["dep:digest", "dep:generic-array", "internal-applet-api-crypto"]
internal-applet-api-platform = []
Expand Down
1 change: 1 addition & 0 deletions crates/scheduler/src/protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ pub fn process_event<B: Board>(scheduler: &mut Scheduler<B>, event: board::Event
State::Tunnel { .. } => unreachable!(),
}
}
#[cfg(not(feature = "_test"))]
_ => Api::DeviceError(Error::internal(Code::NotImplemented)),
};
reply::<B>(&response);
Expand Down
2 changes: 1 addition & 1 deletion crates/scheduler/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ check_board_api board-api- --features=wasm,std,

test_helper

cargo test --lib --features=full-api,wasm,std
cargo test --lib --features=_test,full-api,wasm,std
cargo check --lib --features=full-api,wasm,std,log
cargo check --lib --target=i686-unknown-linux-gnu --features=full-api,native,std
cargo check --lib --target=i686-unknown-linux-gnu --features=full-api,native,std,log
Expand Down

0 comments on commit eeeda7f

Please sign in to comment.