@@ -569,7 +569,15 @@ fn shrinking() {
569569 let alloc = & mut Allocation :: new ( ) ;
570570
571571 Filesystem :: format ( storage) . unwrap ( ) ;
572- let _fs = Filesystem :: mount ( alloc, storage) . unwrap ( ) ;
572+ let fs = Filesystem :: mount ( alloc, storage) . unwrap ( ) ;
573+ fs. write ( path ! ( "some-file" ) , & [ 42 ; 10 ] ) . unwrap ( ) ;
574+ fs. write ( path ! ( "some-large-file" ) , & [ 42 ; 1024 ] ) . unwrap ( ) ;
575+
576+ assert_eq ! ( fs. read:: <10 >( path!( "some-file" ) ) . unwrap( ) , & [ 42 ; 10 ] ) ;
577+ assert_eq ! (
578+ fs. read:: <1024 >( path!( "some-large-file" ) ) . unwrap( ) ,
579+ & [ 42 ; 1024 ]
580+ ) ;
573581
574582 let larger_backend = & mut LargerRam :: default ( ) ;
575583 larger_backend. buf [ ..backend. buf . len ( ) ] . copy_from_slice ( & backend. buf ) ;
@@ -585,8 +593,25 @@ fn shrinking() {
585593 } ) ;
586594
587595 let fs = Filesystem :: mount ( larger_alloc, larger_storage) . unwrap ( ) ;
596+ assert_eq ! ( fs. read:: <10 >( path!( "some-file" ) ) . unwrap( ) , & [ 42 ; 10 ] ) ;
597+ assert_eq ! (
598+ fs. read:: <1024 >( path!( "some-large-file" ) ) . unwrap( ) ,
599+ & [ 42 ; 1024 ]
600+ ) ;
601+
588602 fs. grow ( LargerRamStorage :: BLOCK_COUNT ) . unwrap ( ) ;
603+ assert_eq ! ( fs. read:: <10 >( path!( "some-file" ) ) . unwrap( ) , & [ 42 ; 10 ] ) ;
604+ assert_eq ! (
605+ fs. read:: <1024 >( path!( "some-large-file" ) ) . unwrap( ) ,
606+ & [ 42 ; 1024 ]
607+ ) ;
608+
589609 fs. shrink ( RamStorage :: BLOCK_COUNT ) . unwrap ( ) ;
610+ assert_eq ! ( fs. read:: <10 >( path!( "some-file" ) ) . unwrap( ) , & [ 42 ; 10 ] ) ;
611+ assert_eq ! (
612+ fs. read:: <1024 >( path!( "some-large-file" ) ) . unwrap( ) ,
613+ & [ 42 ; 1024 ]
614+ ) ;
590615}
591616
592617#[ test]
0 commit comments