Skip to content

Commit 2a054bb

Browse files
committed
Move property-test configuration to build.rs
1 parent 3616b24 commit 2a054bb

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ fn main() {
1010
// Option::zip
1111
ac.emit_rustc_version(1, 46);
1212

13+
// Remove this comment if enabled proptests
14+
// ::PROPERTY-TESTS:: autocfg::emit("property_tests");
15+
1316
let outdir: PathBuf = std::env::var_os("OUT_DIR").unwrap().into();
1417
write_default_precision_file(&outdir);
1518
}

scripts/bigdecimal-property-tests

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
sed -i.bak -e 's|# PROPERTY-TESTS: ||' Cargo.toml
1010

1111
# include the property-test file in lib.rs
12-
sed -i.bak -e 's|// ::PROPERTY-TESTS:: ||' src/lib.rs
12+
sed -i.bak -e 's|// ::PROPERTY-TESTS:: ||' build.rs
1313

1414
# Run commands
1515
"$@"

src/lib.rs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3356,8 +3356,14 @@ mod test_with_scale_round {
33563356
include!("lib.tests.with_scale_round.rs");
33573357
}
33583358

3359-
// enable these tests with scripts/bigdecimal-property-tests
3360-
// ::PROPERTY-TESTS:: #[cfg(test)] #[macro_use] extern crate proptest;
3361-
// ::PROPERTY-TESTS:: #[cfg(test)] mod property_tests {
3362-
// ::PROPERTY-TESTS:: use super::*; use paste::paste;
3363-
// ::PROPERTY-TESTS:: include!("lib.tests.property-tests.rs"); }
3359+
3360+
#[cfg(all(test, property_tests))]
3361+
extern crate proptest;
3362+
3363+
#[cfg(all(test, property_tests))]
3364+
mod proptests {
3365+
use super::*;
3366+
use paste::paste;
3367+
3368+
include!("lib.tests.property-tests.rs");
3369+
}

0 commit comments

Comments
 (0)