Skip to content

Commit eeeda7f

Browse files
authored
Make sure that pattern matching is exhaustive in tests (google#503)
1 parent b4a798d commit eeeda7f

File tree

7 files changed

+7
-4
lines changed

7 files changed

+7
-4
lines changed

crates/protocol/CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
## 0.1.0-git
44

5-
<!-- Increment to skip CHANGELOG.md test: 7 -->
5+
<!-- Increment to skip CHANGELOG.md test: 8 -->

crates/protocol/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ wasefire-error = { version = "0.1.1-git", path = "../error" }
1919
wasefire-wire = { version = "0.1.0-git", path = "../wire" }
2020

2121
[features]
22+
_exhaustive = []
2223
full = []
2324
std = ["wasefire-wire/std"]
2425

crates/protocol/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ macro_rules! api {
7676
#[derive(Debug, Wire)]
7777
#[wire(static = T)]
7878
#[cfg_attr(feature = "full", wire(range = $next))]
79-
#[non_exhaustive]
79+
#[cfg_attr(not(feature = "_exhaustive"), non_exhaustive)]
8080
pub enum Api<'a, T: Direction> {
8181
$(
8282
$(#[doc = $doc])* $(#[cfg($cfg)])* #[wire(tag = $tag)]

crates/scheduler/CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -135,4 +135,4 @@
135135

136136
## 0.1.0
137137

138-
<!-- Increment to skip CHANGELOG.md test: 38 -->
138+
<!-- Increment to skip CHANGELOG.md test: 39 -->

crates/scheduler/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ wasm = ["dep:wasefire-interpreter"]
229229
# safety invariant.
230230
unsafe-skip-validation = []
231231
# Internal features.
232+
_test = ["wasefire-protocol?/_exhaustive"]
232233
internal-applet-api-crypto = []
233234
internal-applet-api-crypto-hash = ["dep:digest", "dep:generic-array", "internal-applet-api-crypto"]
234235
internal-applet-api-platform = []

crates/scheduler/src/protocol.rs

+1
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ pub fn process_event<B: Board>(scheduler: &mut Scheduler<B>, event: board::Event
117117
State::Tunnel { .. } => unreachable!(),
118118
}
119119
}
120+
#[cfg(not(feature = "_test"))]
120121
_ => Api::DeviceError(Error::internal(Code::NotImplemented)),
121122
};
122123
reply::<B>(&response);

crates/scheduler/test.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ check_board_api board-api- --features=wasm,std,
2525

2626
test_helper
2727

28-
cargo test --lib --features=full-api,wasm,std
28+
cargo test --lib --features=_test,full-api,wasm,std
2929
cargo check --lib --features=full-api,wasm,std,log
3030
cargo check --lib --target=i686-unknown-linux-gnu --features=full-api,native,std
3131
cargo check --lib --target=i686-unknown-linux-gnu --features=full-api,native,std,log

0 commit comments

Comments
 (0)