mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-15 20:45:44 +00:00
Merge branch 'master' into author-relay-block
This commit is contained in:
@@ -28,7 +28,9 @@ mod testing;
|
||||
pub use self::environment::with_env;
|
||||
pub use self::storage::StorageVec;
|
||||
pub use self::hashable::Hashable;
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
pub use self::statichex::{StaticHexConversion, StaticHexInto};
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
pub use self::testing::{AsBytesRef, HexDisplay, TestExternalities, one, two};
|
||||
pub use self::testing::{AsBytesRef, HexDisplay, one, two};
|
||||
|
||||
@@ -146,9 +146,8 @@ pub trait StorageVec {
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::collections::HashMap;
|
||||
use runtime_std::with_externalities;
|
||||
use support::{TestExternalities, HexDisplay};
|
||||
use runtime_std::{storage, twox_128};
|
||||
use support::HexDisplay;
|
||||
use runtime_std::{storage, twox_128, TestExternalities, with_externalities};
|
||||
|
||||
#[test]
|
||||
fn integers_can_be_stored() {
|
||||
|
||||
@@ -16,30 +16,9 @@
|
||||
|
||||
//! Testing helpers.
|
||||
|
||||
use std::collections::HashMap;
|
||||
use runtime_std::{Externalities, ExternalitiesError};
|
||||
use primitives::AccountID;
|
||||
use super::statichex::StaticHexInto;
|
||||
|
||||
#[derive(Debug, Default)]
|
||||
/// Simple externaties implementation.
|
||||
pub struct TestExternalities {
|
||||
/// The storage map.
|
||||
pub storage: HashMap<Vec<u8>, Vec<u8>>,
|
||||
}
|
||||
|
||||
impl Externalities for TestExternalities {
|
||||
fn storage(&self, key: &[u8]) -> Result<&[u8], ExternalitiesError> {
|
||||
Ok(self.storage.get(&key.to_vec()).map_or(&[] as &[u8], Vec::as_slice))
|
||||
}
|
||||
|
||||
fn set_storage(&mut self, key: Vec<u8>, value: Vec<u8>) {
|
||||
self.storage.insert(key, value);
|
||||
}
|
||||
|
||||
fn chain_id(&self) -> u64 { 42 }
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! map {
|
||||
($( $name:expr => $value:expr ),*) => (
|
||||
|
||||
Reference in New Issue
Block a user