mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-09 02:27:21 +00:00
Move Externalities into its own crate (#3775)
* Move `Externalities` into `substrate-externalities` - `Externalities` now support generic extensions - Split of `primtives-storage` for storage primitive types * Move the externalities scoping into `substrate-externalities` * Fix compilation * Review feedback * Adds macro for declaring extensions * Fix benchmarks * Introduce `ExtensionStore` trait * Last review comments * Implement it for `ExtensionStore`
This commit is contained in:
@@ -22,7 +22,7 @@ use std::collections::HashSet;
|
||||
use ref_thread_local::{ref_thread_local, RefThreadLocal};
|
||||
use sr_primitives::testing::Header;
|
||||
use sr_primitives::Perbill;
|
||||
use primitives::{H256, Blake2Hasher};
|
||||
use primitives::H256;
|
||||
use support::{impl_outer_origin, parameter_types};
|
||||
use {runtime_io, system};
|
||||
use crate::{GenesisConfig, Module, Trait, IsDeadAccount, OnNewAccount, ResolveHint};
|
||||
@@ -96,7 +96,7 @@ impl Trait for Runtime {
|
||||
type Event = ();
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> runtime_io::TestExternalities<Blake2Hasher> {
|
||||
pub fn new_test_ext() -> runtime_io::TestExternalities {
|
||||
{
|
||||
let mut h = ALIVE.borrow_mut();
|
||||
h.clear();
|
||||
|
||||
@@ -20,11 +20,11 @@
|
||||
|
||||
use super::*;
|
||||
use crate::mock::{Indices, new_test_ext, make_account, kill_account, TestIsDeadAccount};
|
||||
use runtime_io::with_externalities;
|
||||
use sr_primitives::set_and_run_with_externalities;
|
||||
|
||||
#[test]
|
||||
fn indexing_lookup_should_work() {
|
||||
with_externalities(
|
||||
set_and_run_with_externalities(
|
||||
&mut new_test_ext(),
|
||||
|| {
|
||||
assert_eq!(Indices::lookup_index(0), Some(1));
|
||||
@@ -38,7 +38,7 @@ fn indexing_lookup_should_work() {
|
||||
|
||||
#[test]
|
||||
fn default_indexing_on_new_accounts_should_work() {
|
||||
with_externalities(
|
||||
set_and_run_with_externalities(
|
||||
&mut new_test_ext(),
|
||||
|| {
|
||||
assert_eq!(Indices::lookup_index(4), None);
|
||||
@@ -50,7 +50,7 @@ fn default_indexing_on_new_accounts_should_work() {
|
||||
|
||||
#[test]
|
||||
fn reclaim_indexing_on_new_accounts_should_work() {
|
||||
with_externalities(
|
||||
set_and_run_with_externalities(
|
||||
&mut new_test_ext(),
|
||||
|| {
|
||||
assert_eq!(Indices::lookup_index(1), Some(2));
|
||||
@@ -66,7 +66,7 @@ fn reclaim_indexing_on_new_accounts_should_work() {
|
||||
|
||||
#[test]
|
||||
fn alive_account_should_prevent_reclaim() {
|
||||
with_externalities(
|
||||
set_and_run_with_externalities(
|
||||
&mut new_test_ext(),
|
||||
|| {
|
||||
assert!(!TestIsDeadAccount::is_dead_account(&2));
|
||||
|
||||
Reference in New Issue
Block a user