@@ -137,6 +137,7 @@ fn migrate_works() {
137
137
BagThresholds :: set ( NEW_THRESHOLDS ) ;
138
138
// and we call
139
139
List :: < Runtime > :: migrate ( old_thresholds) ;
140
+ assert_eq ! ( List :: <Runtime >:: do_try_state( ) , Ok ( ( ) ) ) ;
140
141
141
142
// then
142
143
assert_eq ! (
@@ -352,13 +353,13 @@ mod list {
352
353
#[ test]
353
354
fn try_state_works ( ) {
354
355
ExtBuilder :: default ( ) . build_and_execute_no_post_check ( || {
355
- assert_ok ! ( List :: <Runtime >:: try_state ( ) ) ;
356
+ assert_ok ! ( List :: <Runtime >:: do_try_state ( ) ) ;
356
357
} ) ;
357
358
358
359
// make sure there are no duplicates.
359
360
ExtBuilder :: default ( ) . build_and_execute_no_post_check ( || {
360
361
Bag :: < Runtime > :: get ( 10 ) . unwrap ( ) . insert_unchecked ( 2 , 10 ) ;
361
- assert_eq ! ( List :: <Runtime >:: try_state ( ) , Err ( "duplicate identified" ) ) ;
362
+ assert_eq ! ( List :: <Runtime >:: do_try_state ( ) , Err ( "duplicate identified" ) ) ;
362
363
} ) ;
363
364
364
365
// ensure count is in sync with `ListNodes::count()`.
@@ -372,7 +373,7 @@ mod list {
372
373
CounterForListNodes :: < Runtime > :: mutate ( |counter| * counter += 1 ) ;
373
374
assert_eq ! ( crate :: ListNodes :: <Runtime >:: count( ) , 5 ) ;
374
375
375
- assert_eq ! ( List :: <Runtime >:: try_state ( ) , Err ( "iter_count != stored_count" ) ) ;
376
+ assert_eq ! ( List :: <Runtime >:: do_try_state ( ) , Err ( "iter_count != stored_count" ) ) ;
376
377
} ) ;
377
378
}
378
379
@@ -804,7 +805,7 @@ mod bags {
804
805
805
806
// then
806
807
assert_eq ! ( bag_as_ids( & bag_1000) , vec![ 2 , 3 , 13 , 14 ] ) ;
807
- assert_ok ! ( bag_1000. try_state ( ) ) ;
808
+ assert_ok ! ( bag_1000. do_try_state ( ) ) ;
808
809
// and the node isn't mutated when its removed
809
810
assert_eq ! ( node_4, node_4_pre_remove) ;
810
811
@@ -814,23 +815,23 @@ mod bags {
814
815
815
816
// then
816
817
assert_eq ! ( bag_as_ids( & bag_1000) , vec![ 3 , 13 , 14 ] ) ;
817
- assert_ok ! ( bag_1000. try_state ( ) ) ;
818
+ assert_ok ! ( bag_1000. do_try_state ( ) ) ;
818
819
819
820
// when removing a tail that is not pointing at the head
820
821
let node_14 = Node :: < Runtime > :: get ( & 14 ) . unwrap ( ) ;
821
822
bag_1000. remove_node_unchecked ( & node_14) ;
822
823
823
824
// then
824
825
assert_eq ! ( bag_as_ids( & bag_1000) , vec![ 3 , 13 ] ) ;
825
- assert_ok ! ( bag_1000. try_state ( ) ) ;
826
+ assert_ok ! ( bag_1000. do_try_state ( ) ) ;
826
827
827
828
// when removing a tail that is pointing at the head
828
829
let node_13 = Node :: < Runtime > :: get ( & 13 ) . unwrap ( ) ;
829
830
bag_1000. remove_node_unchecked ( & node_13) ;
830
831
831
832
// then
832
833
assert_eq ! ( bag_as_ids( & bag_1000) , vec![ 3 ] ) ;
833
- assert_ok ! ( bag_1000. try_state ( ) ) ;
834
+ assert_ok ! ( bag_1000. do_try_state ( ) ) ;
834
835
835
836
// when removing a node that is both the head & tail
836
837
let node_3 = Node :: < Runtime > :: get ( & 3 ) . unwrap ( ) ;
@@ -846,15 +847,15 @@ mod bags {
846
847
847
848
// then
848
849
assert_eq ! ( bag_as_ids( & bag_10) , vec![ 1 , 12 ] ) ;
849
- assert_ok ! ( bag_10. try_state ( ) ) ;
850
+ assert_ok ! ( bag_10. do_try_state ( ) ) ;
850
851
851
852
// when removing a head that is pointing at the tail
852
853
let node_1 = Node :: < Runtime > :: get ( & 1 ) . unwrap ( ) ;
853
854
bag_10. remove_node_unchecked ( & node_1) ;
854
855
855
856
// then
856
857
assert_eq ! ( bag_as_ids( & bag_10) , vec![ 12 ] ) ;
857
- assert_ok ! ( bag_10. try_state ( ) ) ;
858
+ assert_ok ! ( bag_10. do_try_state ( ) ) ;
858
859
// and since we updated the bag's head/tail, we need to write this storage so we
859
860
// can correctly `get` it again in later checks
860
861
bag_10. put ( ) ;
@@ -865,15 +866,15 @@ mod bags {
865
866
866
867
// then
867
868
assert_eq ! ( bag_as_ids( & bag_2000) , vec![ 15 , 17 , 18 , 19 ] ) ;
868
- assert_ok ! ( bag_2000. try_state ( ) ) ;
869
+ assert_ok ! ( bag_2000. do_try_state ( ) ) ;
869
870
870
871
// when removing a node that is pointing at tail, but not head
871
872
let node_18 = Node :: < Runtime > :: get ( & 18 ) . unwrap ( ) ;
872
873
bag_2000. remove_node_unchecked ( & node_18) ;
873
874
874
875
// then
875
876
assert_eq ! ( bag_as_ids( & bag_2000) , vec![ 15 , 17 , 19 ] ) ;
876
- assert_ok ! ( bag_2000. try_state ( ) ) ;
877
+ assert_ok ! ( bag_2000. do_try_state ( ) ) ;
877
878
878
879
// finally, when reading from storage, the state of all bags is as expected
879
880
assert_eq ! (
@@ -905,7 +906,7 @@ mod bags {
905
906
// .. and the bag it was removed from
906
907
let bag_1000 = Bag :: < Runtime > :: get ( 1_000 ) . unwrap ( ) ;
907
908
// is sane
908
- assert_ok ! ( bag_1000. try_state ( ) ) ;
909
+ assert_ok ! ( bag_1000. do_try_state ( ) ) ;
909
910
// and has the correct head and tail.
910
911
assert_eq ! ( bag_1000. head, Some ( 3 ) ) ;
911
912
assert_eq ! ( bag_1000. tail, Some ( 4 ) ) ;
0 commit comments