@@ -1349,6 +1349,29 @@ fn test_multiple_output_files() {
13491349 . stderr_is ( "sort: multiple output files specified\n " ) ;
13501350}
13511351
1352+ #[ test]
1353+ fn test_output_file_with_leading_dash ( ) {
1354+ let test_cases = [
1355+ (
1356+ [ "--output" , "--dash-file" ] ,
1357+ "banana\n apple\n cherry\n " ,
1358+ "apple\n banana\n cherry\n " ,
1359+ ) ,
1360+ (
1361+ [ "-o" , "--another-dash-file" ] ,
1362+ "zebra\n xray\n yak\n " ,
1363+ "xray\n yak\n zebra\n " ,
1364+ ) ,
1365+ ] ;
1366+
1367+ for ( args, input, expected) in test_cases {
1368+ let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
1369+ ucmd. args ( & args) . pipe_in ( input) . succeeds ( ) . no_stdout ( ) ;
1370+
1371+ assert_eq ! ( at. read( args[ 1 ] ) , expected) ;
1372+ }
1373+ }
1374+
13521375#[ test]
13531376// Test for GNU tests/sort/sort-files0-from.pl "f-extra-arg"
13541377fn test_files0_from_extra_arg ( ) {
@@ -1698,26 +1721,4 @@ fn test_clap_localization_invalid_value() {
16981721 }
16991722}
17001723
1701- #[ test]
1702- fn test_clap_localization_tip_for_value_with_dash ( ) {
1703- let test_cases = vec ! [
1704- ( "en_US.UTF-8" , vec![ "tip:" , "-- --file-with-dash" ] ) ,
1705- ( "fr_FR.UTF-8" , vec![ "tip:" , "-- --file-with-dash" ] ) , // TODO: fix French translation
1706- ] ;
1707-
1708- for ( locale, expected_strings) in test_cases {
1709- let result = new_ucmd ! ( )
1710- . env ( "LANG" , locale)
1711- . env ( "LC_ALL" , locale)
1712- . arg ( "--output" )
1713- . arg ( "--file-with-dash" )
1714- . fails ( ) ;
1715-
1716- let stderr = result. stderr_str ( ) ;
1717- for expected in expected_strings {
1718- assert ! ( stderr. contains( expected) ) ;
1719- }
1720- }
1721- }
1722-
17231724/* spell-checker: enable */
0 commit comments