Skip to content

Commit 517224a

Browse files
committed
fix: fix feature flags for tests
1 parent 260748f commit 517224a

File tree

11 files changed

+28
-2
lines changed

11 files changed

+28
-2
lines changed

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
uniffi = ["dep:uniffi", "dep:anyhow"]
4141

4242
[dependencies]

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

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

293293
#[cfg(test)]
294294
mod test {
295+
#[cfg(feature = "proptest")]
295296
use test_strategy::proptest;
296297
#[cfg(target_arch = "wasm32")]
297298
use wasm_bindgen_test::wasm_bindgen_test as test;
@@ -318,6 +319,7 @@ mod test {
318319
}
319320

320321
#[proptest]
322+
#[cfg(feature = "proptest")]
321323
fn roundtrip_display_fromstr(address: Address) {
322324
let s = address.to_string();
323325
let a = s.parse::<Address>().unwrap();

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,16 @@ macro_rules! impl_base64_helper {
135135

136136
#[cfg(test)]
137137
mod $test_module {
138+
#[cfg(feature = "proptest")]
138139
use test_strategy::proptest;
139140
#[cfg(target_arch = "wasm32")]
140141
use wasm_bindgen_test::wasm_bindgen_test as test;
141142

143+
#[cfg(feature = "proptest")]
142144
use super::{$display, $fromstr};
143145

144146
#[proptest]
147+
#[cfg(feature = "proptest")]
145148
fn roundtrip_display_fromstr(array: $fromstr) {
146149
let s = $display(&array.0).to_string();
147150
let a = s.parse::<$fromstr>().unwrap();

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,9 +407,11 @@ impl proptest::arbitrary::Arbitrary for PasskeyAuthenticator {
407407

408408
#[cfg(test)]
409409
mod tests {
410+
#[cfg(feature = "serde")]
410411
use crate::UserSignature;
411412

412413
#[test]
414+
#[cfg(feature = "serde")]
413415
fn base64_encoded_passkey_user_signature() {
414416
let b64 = "BiVYDmenOnqS+thmz5m5SrZnWaKXZLVxgh+rri6LHXs25B0AAAAAnQF7InR5cGUiOiJ3ZWJhdXRobi5nZXQiLCAiY2hhbGxlbmdlIjoiQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQSIsIm9yaWdpbiI6Imh0dHA6Ly9sb2NhbGhvc3Q6NTE3MyIsImNyb3NzT3JpZ2luIjpmYWxzZSwgInVua25vd24iOiAidW5rbm93biJ9YgJMwqcOmZI7F/N+K5SMe4DRYCb4/cDWW68SFneSHoD2GxKKhksbpZ5rZpdrjSYABTCsFQQBpLORzTvbj4edWKd/AsEBeovrGvHR9Ku7critg6k7qvfFlPUngujXfEzXd8Eg";
415417

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -687,13 +687,15 @@ mod serialization {
687687
#[cfg(test)]
688688
mod test {
689689
use base64ct::{Base64, Encoding};
690+
#[cfg(feature = "proptest")]
690691
use test_strategy::proptest;
691692
#[cfg(target_arch = "wasm32")]
692693
use wasm_bindgen_test::wasm_bindgen_test as test;
693694

694695
use super::*;
695696

696697
#[proptest]
698+
#[cfg(feature = "proptest")]
697699
fn roundtrip_signature_scheme(scheme: SignatureScheme) {
698700
assert_eq!(Ok(scheme), SignatureScheme::from_byte(scheme.to_u8()));
699701
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ mod test {
167167
#[cfg(target_arch = "wasm32")]
168168
use wasm_bindgen_test::wasm_bindgen_test as test;
169169

170+
#[cfg(feature = "serde")]
170171
use super::*;
171172

172173
#[cfg(feature = "serde")]

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

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

407407
#[cfg(test)]
408408
mod test {
409+
#[cfg(feature = "proptest")]
409410
use std::str::FromStr;
410411

412+
#[cfg(feature = "proptest")]
411413
use num_bigint::BigUint;
414+
#[cfg(feature = "proptest")]
412415
use proptest::prelude::*;
416+
#[cfg(feature = "proptest")]
413417
use test_strategy::proptest;
414418
#[cfg(target_arch = "wasm32")]
415419
use wasm_bindgen_test::wasm_bindgen_test as test;
@@ -428,6 +432,7 @@ mod test {
428432
}
429433

430434
#[proptest]
435+
#[cfg(feature = "proptest")]
431436
fn dont_crash_on_large_inputs(
432437
#[strategy(proptest::collection::vec(any::<u8>(), 33..1024))] bytes: Vec<u8>,
433438
) {
@@ -439,6 +444,7 @@ mod test {
439444
}
440445

441446
#[proptest]
447+
#[cfg(feature = "proptest")]
442448
fn valid_address_seeds(
443449
#[strategy(proptest::collection::vec(any::<u8>(), 1..=32))] bytes: Vec<u8>,
444450
) {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,16 @@ pub type SigningDigest = [u8; Digest::LENGTH];
361361

362362
#[cfg(test)]
363363
mod test {
364+
#[cfg(feature = "proptest")]
364365
use test_strategy::proptest;
365366
#[cfg(target_arch = "wasm32")]
366367
use wasm_bindgen_test::wasm_bindgen_test as test;
367368

369+
#[cfg(feature = "proptest")]
368370
use super::*;
369371

370372
#[proptest]
373+
#[cfg(feature = "proptest")]
371374
fn roundtrip_display_fromstr(digest: Digest) {
372375
let s = digest.to_string();
373376
let d = s.parse::<Digest>().unwrap();

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ mod test {
133133
#[cfg(target_arch = "wasm32")]
134134
use wasm_bindgen_test::wasm_bindgen_test as test;
135135

136+
#[cfg(feature = "serde")]
136137
use super::*;
137138

138139
#[test]

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,7 @@ pub struct ChangeEpochV2 {
719719
/// write out the modules below. Modules are provided with the version they
720720
/// will be upgraded to, their modules in serialized form (which include
721721
/// their package ID), and a list of their transitive dependencies.
722-
#[cfg_attr(test, any(proptest::collection::size_range(0..=2).lift()))]
722+
#[cfg_attr(feature = "proptest", any(proptest::collection::size_range(0..=2).lift()))]
723723
pub system_packages: Vec<SystemPackage>,
724724
}
725725

0 commit comments

Comments
 (0)