diff --git a/crates/app-core/src/lib.rs b/crates/app-core/src/lib.rs index 8b8f2cd..e0bf220 100644 --- a/crates/app-core/src/lib.rs +++ b/crates/app-core/src/lib.rs @@ -19,9 +19,9 @@ #![no_std] // See the comment in `crates/test-utils/src/lib.rs` for the meaning of these attributes. #![cfg_attr(test, no_main)] -#![feature(custom_test_frameworks)] -#![test_runner(ledger_device_sdk::testing::sdk_test_runner)] -#![reexport_test_harness_main = "test_main"] +#![cfg_attr(test, feature(custom_test_frameworks))] +#![cfg_attr(test, test_runner(ledger_device_sdk::testing::sdk_test_runner))] +#![cfg_attr(test, reexport_test_harness_main = "test_main")] #[cfg(test)] test_utils::impl_panic_handler!(); diff --git a/crates/messages/src/lib.rs b/crates/messages/src/lib.rs index 5aa632c..7031553 100644 --- a/crates/messages/src/lib.rs +++ b/crates/messages/src/lib.rs @@ -18,9 +18,9 @@ #![no_std] // See the comment in `crates/test-utils/src/lib.rs` for the meaning of these attributes. #![cfg_attr(test, no_main)] -#![feature(custom_test_frameworks)] -#![test_runner(ledger_device_sdk::testing::sdk_test_runner)] -#![reexport_test_harness_main = "test_main"] +#![cfg_attr(test, feature(custom_test_frameworks))] +#![cfg_attr(test, test_runner(ledger_device_sdk::testing::sdk_test_runner))] +#![cfg_attr(test, reexport_test_harness_main = "test_main")] #[cfg(test)] test_utils::impl_panic_handler!(); diff --git a/crates/test-utils/src/lib.rs b/crates/test-utils/src/lib.rs index 2e33220..67e6d9c 100644 --- a/crates/test-utils/src/lib.rs +++ b/crates/test-utils/src/lib.rs @@ -25,7 +25,7 @@ //! 2. "custom_test_frameworks" must be enabled to be able to specify the custom runner and use //! the `#[test_case]` attribute (used internally by `testmacro::test_item`). //! -//! #![feature(custom_test_frameworks)] +//! #![cfg_attr(test, feature(custom_test_frameworks))] //! //! 3. Specify the custom test runner. All test cases collected by `#[test_case]` will be passed //! to this function. In particular, `sdk_test_runner` will loop over the array of test cases @@ -33,13 +33,13 @@ //! a) fix references stored inside the test case via pic_rs/pic; //! b) invoke the closure associated with the test case. //! -//! #![test_runner(ledger_device_sdk::testing::sdk_test_runner)] +//! #![cfg_attr(test, test_runner(ledger_device_sdk::testing::sdk_test_runner))] //! //! //! 4. The following will put `fn test_main` at the test crate's root, which will call the runner //! that we've specified above. The crate's `sample_main` will have to call `test_main`. //! -//! #![reexport_test_harness_main = "test_main"] +//! #![cfg_attr(test, reexport_test_harness_main = "test_main")] //! 3. Under `#[cfg(test)]` call: //! 1. test_utils::impl_panic_handler!(); //! 2. test_utils::impl_main!();