@@ -690,6 +690,24 @@ fn test_block_size_from_env() {
690690 assert_eq ! ( get_header( "BLOCKSIZE" , "333" ) , "333B-blocks" ) ;
691691}
692692
693+ #[ test]
694+ fn test_block_size_from_env_zero ( ) {
695+ fn get_header ( env_var : & str , env_value : & str ) -> String {
696+ let output = new_ucmd ! ( )
697+ . arg ( "--output=size" )
698+ . env ( env_var, env_value)
699+ . succeeds ( )
700+ . stdout_str_lossy ( ) ;
701+ output. lines ( ) . next ( ) . unwrap ( ) . trim ( ) . to_string ( )
702+ }
703+
704+ let default_block_size_header = "1K-blocks" ;
705+
706+ assert_eq ! ( get_header( "DF_BLOCK_SIZE" , "0" ) , default_block_size_header) ;
707+ assert_eq ! ( get_header( "BLOCK_SIZE" , "0" ) , default_block_size_header) ;
708+ assert_eq ! ( get_header( "BLOCKSIZE" , "0" ) , default_block_size_header) ;
709+ }
710+
693711#[ test]
694712fn test_block_size_from_env_precedences ( ) {
695713 fn get_header ( one : ( & str , & str ) , two : ( & str , & str ) ) -> String {
@@ -747,6 +765,16 @@ fn test_invalid_block_size_from_env() {
747765 let header = output. lines ( ) . next ( ) . unwrap ( ) . trim ( ) . to_string ( ) ;
748766
749767 assert_eq ! ( header, default_block_size_header) ;
768+
769+ let output = new_ucmd ! ( )
770+ . arg ( "--output=size" )
771+ . env ( "DF_BLOCK_SIZE" , "0" )
772+ . env ( "BLOCK_SIZE" , "222" )
773+ . succeeds ( )
774+ . stdout_str_lossy ( ) ;
775+ let header = output. lines ( ) . next ( ) . unwrap ( ) . trim ( ) . to_string ( ) ;
776+
777+ assert_eq ! ( header, default_block_size_header) ;
750778}
751779
752780#[ test]
0 commit comments