Commit af739fa 1 parent c439f81 commit af739fa Copy full SHA for af739fa
File tree 2 files changed +11
-6
lines changed
2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -1626,12 +1626,8 @@ fn split(settings: &Settings) -> UResult<()> {
1626
1626
let r_box = if settings. input == "-" {
1627
1627
Box :: new ( stdin ( ) ) as Box < dyn Read >
1628
1628
} else {
1629
- let r = File :: open ( Path :: new ( & settings. input ) ) . map_err_context ( || {
1630
- format ! (
1631
- "cannot open {} for reading: No such file or directory" ,
1632
- settings. input. quote( )
1633
- )
1634
- } ) ?;
1629
+ let r = File :: open ( Path :: new ( & settings. input ) )
1630
+ . map_err_context ( || format ! ( "cannot open {} for reading" , settings. input. quote( ) ) ) ?;
1635
1631
Box :: new ( r) as Box < dyn Read >
1636
1632
} ;
1637
1633
let mut reader = if let Some ( c) = settings. io_blksize {
Original file line number Diff line number Diff line change @@ -123,6 +123,15 @@ fn test_invalid_arg() {
123
123
new_ucmd ! ( ) . arg ( "--definitely-invalid" ) . fails ( ) . code_is ( 1 ) ;
124
124
}
125
125
126
+ #[ test]
127
+ fn test_split_non_existing_file ( ) {
128
+ new_ucmd ! ( )
129
+ . arg ( "non-existing" )
130
+ . fails ( )
131
+ . code_is ( 1 )
132
+ . stderr_is ( "split: cannot open 'non-existing' for reading: No such file or directory\n " ) ;
133
+ }
134
+
126
135
#[ test]
127
136
fn test_split_default ( ) {
128
137
let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
You can’t perform that action at this time.
0 commit comments