Skip to content

Commit 9d0081c

Browse files
committed
fix: fix feature flags for tests
1 parent 48d4d9c commit 9d0081c

File tree

13 files changed

+30
-11
lines changed

13 files changed

+30
-11
lines changed

crates/iota-crypto/src/simple.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,12 @@ mod keypair {
467467
}
468468
}
469469

470-
#[cfg(test)]
470+
#[cfg(all(
471+
test,
472+
feature = "ed25519",
473+
feature = "secp256k1",
474+
feature = "secp256r1"
475+
))]
471476
mod test {
472477
use test_strategy::proptest;
473478

crates/iota-sdk-types/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ serde = [
3636
schemars = ["serde", "dep:schemars", "dep:serde_json"]
3737
rand = ["dep:rand_core"]
3838
hash = ["dep:blake2"]
39-
proptest = ["dep:proptest", "dep:test-strategy", "serde"]
39+
proptest = ["dep:proptest", "dep:test-strategy", "serde", "schemars"]
4040

4141
[dependencies]
4242
base64ct = { version = "1.6.0", features = ["alloc"] }

crates/iota-sdk-types/src/address.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,7 @@ impl schemars::JsonSchema for Address {
283283

284284
#[cfg(test)]
285285
mod test {
286+
#[cfg(feature = "proptest")]
286287
use test_strategy::proptest;
287288
#[cfg(target_arch = "wasm32")]
288289
use wasm_bindgen_test::wasm_bindgen_test as test;
@@ -309,6 +310,7 @@ mod test {
309310
}
310311

311312
#[proptest]
313+
#[cfg(feature = "proptest")]
312314
fn roundtrip_display_fromstr(address: Address) {
313315
let s = address.to_string();
314316
let a = s.parse::<Address>().unwrap();

crates/iota-sdk-types/src/crypto/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ macro_rules! impl_base64_helper {
133133
}
134134
}
135135

136-
#[cfg(test)]
136+
#[cfg(all(feature = "proptest", test))]
137137
mod $test_module {
138138
use test_strategy::proptest;
139139

crates/iota-sdk-types/src/crypto/passkey.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ impl proptest::arbitrary::Arbitrary for PasskeyAuthenticator {
404404
}
405405
}
406406

407-
#[cfg(test)]
407+
#[cfg(all(feature = "serde", test))]
408408
mod tests {
409409
use crate::UserSignature;
410410

crates/iota-sdk-types/src/crypto/signature.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,13 +684,15 @@ mod serialization {
684684
#[cfg(test)]
685685
mod test {
686686
use base64ct::{Base64, Encoding};
687+
#[cfg(feature = "proptest")]
687688
use test_strategy::proptest;
688689
#[cfg(target_arch = "wasm32")]
689690
use wasm_bindgen_test::wasm_bindgen_test as test;
690691

691692
use super::*;
692693

693694
#[proptest]
695+
#[cfg(feature = "proptest")]
694696
fn roundtrip_signature_scheme(scheme: SignatureScheme) {
695697
assert_eq!(Ok(scheme), SignatureScheme::from_byte(scheme.to_u8()));
696698
}

crates/iota-sdk-types/src/crypto/validator.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,13 @@ pub struct ValidatorSignature {
161161
pub signature: Bls12381Signature,
162162
}
163163

164-
#[cfg(test)]
164+
#[cfg(all(feature = "serde", test))]
165165
mod test {
166166
#[cfg(target_arch = "wasm32")]
167167
use wasm_bindgen_test::wasm_bindgen_test as test;
168168

169169
use super::*;
170170

171-
#[cfg(feature = "serde")]
172171
#[test]
173172
fn aggregated_signature_fixture() {
174173
use base64ct::{Base64, Encoding};

crates/iota-sdk-types/src/crypto/zklogin.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,10 +360,14 @@ impl std::str::FromStr for Bn254FieldElement {
360360

361361
#[cfg(test)]
362362
mod test {
363+
#[cfg(feature = "proptest")]
363364
use std::str::FromStr;
364365

366+
#[cfg(feature = "proptest")]
365367
use num_bigint::BigUint;
368+
#[cfg(feature = "proptest")]
366369
use proptest::prelude::*;
370+
#[cfg(feature = "proptest")]
367371
use test_strategy::proptest;
368372
#[cfg(target_arch = "wasm32")]
369373
use wasm_bindgen_test::wasm_bindgen_test as test;
@@ -381,6 +385,7 @@ mod test {
381385
assert_eq!(seed.unpadded(), [1; 31].as_slice());
382386
}
383387

388+
#[cfg(feature = "proptest")]
384389
#[proptest]
385390
fn dont_crash_on_large_inputs(
386391
#[strategy(proptest::collection::vec(any::<u8>(), 33..1024))] bytes: Vec<u8>,
@@ -392,6 +397,7 @@ mod test {
392397
let _ = Bn254FieldElement::from_str(&radix10);
393398
}
394399

400+
#[cfg(feature = "proptest")]
395401
#[proptest]
396402
fn valid_address_seeds(
397403
#[strategy(proptest::collection::vec(any::<u8>(), 1..=32))] bytes: Vec<u8>,

crates/iota-sdk-types/src/digest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ impl_digest!(EffectsAuxiliaryDataDigest);
347347
// serialized
348348
pub type SigningDigest = [u8; Digest::LENGTH];
349349

350-
#[cfg(test)]
350+
#[cfg(all(feature = "proptest", test))]
351351
mod test {
352352
use test_strategy::proptest;
353353

crates/iota-sdk-types/src/gas.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,14 @@ impl std::fmt::Display for GasCostSummary {
127127
}
128128
}
129129

130-
#[cfg(test)]
130+
#[cfg(all(feature = "serde", test))]
131131
mod test {
132132
#[cfg(target_arch = "wasm32")]
133133
use wasm_bindgen_test::wasm_bindgen_test as test;
134134

135135
use super::*;
136136

137137
#[test]
138-
#[cfg(feature = "serde")]
139138
fn formats() {
140139
let actual = GasCostSummary {
141140
computation_cost: 42,

0 commit comments

Comments
 (0)