Skip to content

Commit

Permalink
ref: rename tests feature to std
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfertel committed Apr 9, 2024
1 parent cf32874 commit 9537bd0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
7 changes: 6 additions & 1 deletion contracts/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,15 @@ once_cell = "1.19.0"

[features]
default = []
tests = []

erc20 = []
erc20_metadata = ["erc20"]
erc721 = []

# Enables using the standard library. This is not included in the default
# features, because this crate is meant to be used in a `no_std` environment.
# Currently, the std feature is only used for testing purposes.
std = []

[lib]
crate-type = ["lib", "cdylib"]
2 changes: 1 addition & 1 deletion contracts/src/erc20/extensions/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl Metadata {
}
}

#[cfg(all(test, feature = "tests"))]
#[cfg(all(test, feature = "std"))]
mod tests {
use alloy_primitives::U256;
use stylus_sdk::storage::{StorageBool, StorageString, StorageType};
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/erc20/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ impl ERC20 {
}
}

#[cfg(all(test, feature = "tests"))]
#[cfg(all(test, feature = "std"))]
mod tests {
use alloy_primitives::{address, Address, U256};
use stylus_sdk::{
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/erc721/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ impl ERC721 {
}
}

#[cfg(all(test, feature = "tests"))]
#[cfg(all(test, feature = "std"))]
mod tests {
use alloy_primitives::address;
use once_cell::sync::Lazy;
Expand Down
8 changes: 4 additions & 4 deletions contracts/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#![doc = include_str!("../../README.md")]
#![warn(missing_docs, unreachable_pub, rust_2021_compatibility)]
#![warn(clippy::all, clippy::pedantic)]
#![cfg_attr(not(feature = "tests"), no_std, no_main)]
#![cfg_attr(not(feature = "std"), no_std, no_main)]
extern crate alloc;

#[global_allocator]
static ALLOC: mini_alloc::MiniAlloc = mini_alloc::MiniAlloc::INIT;

mod arithmetic;
#[cfg(any(feature = "tests", feature = "erc20"))]
#[cfg(any(feature = "std", feature = "erc20"))]
pub mod erc20;
#[cfg(any(feature = "tests", feature = "erc721"))]
#[cfg(any(feature = "std", feature = "erc721"))]
pub mod erc721;

#[cfg(not(any(feature = "tests", target_arch = "wasm32-unknown-unknown")))]
#[cfg(not(any(feature = "std", target_arch = "wasm32-unknown-unknown")))]
#[panic_handler]
fn panic(_info: &core::panic::PanicInfo) -> ! {
loop {}
Expand Down

0 comments on commit 9537bd0

Please sign in to comment.