File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ use crate::{
4040} ;
4141use clap:: ArgMatches ;
4242use std:: fmt;
43+ use std:: path:: is_separator;
4344use uucore:: display:: Quotable ;
4445use uucore:: error:: { UResult , USimpleError } ;
4546
@@ -230,7 +231,7 @@ impl Suffix {
230231 . get_one :: < String > ( OPT_ADDITIONAL_SUFFIX )
231232 . unwrap ( )
232233 . to_string ( ) ;
233- if additional. contains ( '/' ) || additional . contains ( '\\' ) {
234+ if additional. chars ( ) . any ( is_separator ) {
234235 return Err ( SuffixError :: ContainsSeparator ( additional) ) ;
235236 }
236237
Original file line number Diff line number Diff line change @@ -247,11 +247,14 @@ fn test_split_additional_suffix() {
247247}
248248
249249#[ test]
250- fn test_additional_suffix_no_slash ( ) {
250+ fn test_additional_suffix_dir_separator ( ) {
251+ #[ cfg( unix) ]
251252 new_ucmd ! ( )
252253 . args ( & [ "--additional-suffix" , "a/b" ] )
253254 . fails ( )
254255 . usage_error ( "invalid suffix 'a/b', contains directory separator" ) ;
256+
257+ #[ cfg( windows) ]
255258 new_ucmd ! ( )
256259 . args ( & [ "--additional-suffix" , "a\\ b" ] )
257260 . fails ( )
You can’t perform that action at this time.
0 commit comments