use the map! macro instead of defining it all over the place (#867)

* remove one map implementation in test

* remove one map macro

* remove one map macro

* remove one map macro
This commit is contained in:
guanqun
2018-10-03 20:22:58 +08:00
committed by Gav Wood
parent d14700f7b6
commit 35f3fe7e77
6 changed files with 4 additions and 29 deletions
+1
View File
@@ -32,6 +32,7 @@
extern crate parity_codec as codec;
extern crate sr_io as runtime_io;
#[cfg_attr(test, macro_use)]
extern crate substrate_primitives as primitives;
extern crate substrate_serializer as serializer;
extern crate substrate_state_machine as state_machine;
@@ -558,13 +558,6 @@ mod tests {
use codec::Encode;
use state_machine::TestExternalities;
// TODO: move into own crate.
macro_rules! map {
($( $name:expr => $value:expr ),*) => (
vec![ $( ( $name, $value ) ),* ].into_iter().collect()
)
}
#[test]
fn returning_should_work() {
let mut ext = TestExternalities::default();
+1 -7
View File
@@ -32,7 +32,7 @@ extern crate substrate_trie;
extern crate parking_lot;
extern crate heapsize;
extern crate substrate_primitives as primitives;
#[cfg_attr(test, macro_use)] extern crate substrate_primitives as primitives;
extern crate parity_codec as codec;
extern crate substrate_trie as trie;
@@ -522,12 +522,6 @@ mod tests {
impl Error for u8 {}
macro_rules! map {
($( $name:expr => $value:expr ),*) => (
vec![ $( ( $name, $value ) ),* ].into_iter().collect()
)
}
#[test]
fn execute_works() {
assert_eq!(execute(
@@ -68,12 +68,6 @@ impl GenesisConfig {
}
}
macro_rules! map {
($( $name:expr => $value:expr ),*) => (
vec![ $( ( $name, $value ) ),* ].into_iter().collect()
)
}
pub fn additional_storage_with_genesis(genesis_block: &::Block) -> HashMap<Vec<u8>, Vec<u8>> {
map![
twox_128(&b"latest"[..]).to_vec() => genesis_block.hash().0.to_vec()
+1 -1
View File
@@ -43,7 +43,7 @@ extern crate sr_version as runtime_version;
extern crate hex_literal;
#[cfg(test)]
extern crate substrate_keyring as keyring;
#[cfg_attr(test, macro_use)]
#[cfg_attr(any(feature = "std", test), macro_use)]
extern crate substrate_primitives as primitives;
#[cfg(feature = "std")] pub mod genesismap;
+1 -8
View File
@@ -19,7 +19,7 @@
extern crate node_runtime;
#[macro_use] extern crate substrate_executor;
extern crate substrate_primitives as primitives;
#[cfg_attr(test, macro_use)] extern crate substrate_primitives as primitives;
#[cfg(test)] extern crate substrate_keyring as keyring;
#[cfg(test)] extern crate sr_primitives as runtime_primitives;
@@ -69,13 +69,6 @@ mod tests {
const COMPACT_CODE: &[u8] = include_bytes!("../../runtime/wasm/target/wasm32-unknown-unknown/release/node_runtime.compact.wasm");
const GENESIS_HASH: [u8; 32] = [69u8; 32];
// TODO: move into own crate.
macro_rules! map {
($( $name:expr => $value:expr ),*) => (
vec![ $( ( $name, $value ) ),* ].into_iter().collect()
)
}
fn alice() -> AccountId {
AccountId::from(Keyring::Alice.to_raw_public())
}