@@ -52,13 +52,13 @@ mod shebang {
5252 "trimming works for tabs as well"
5353 ) ;
5454 assert_eq ! (
55- parse( "#!\\ bin\ \ sh" ) ,
56- exe( " \\ bin\ \ sh") ,
55+ parse( r "#!\bin\sh") ,
56+ exe( r"\ bin\sh") ,
5757 "backslashes are recognized as path separator"
5858 ) ;
5959 assert_eq ! (
6060 parse( "#!C:\\ Program Files\\ shell.exe\r \n some stuff" ) ,
61- exe( "C:\\ Program Files\ \ shell.exe" ) ,
61+ exe( r "C:\Program Files\shell.exe") ,
6262 "absolute windows paths are fine"
6363 ) ;
6464 assert_eq ! (
@@ -192,8 +192,8 @@ mod context {
192192 #[ test]
193193 fn glob_pathspecs_sets_env_only ( ) {
194194 for ( value, expected) in [
195- ( false , "GIT_NOGLOB_PATHSPECS=\" 1 \" " ) ,
196- ( true , "GIT_GLOB_PATHSPECS=\" 1 \" " ) ,
195+ ( false , r# "GIT_NOGLOB_PATHSPECS="1""# ) ,
196+ ( true , r# "GIT_GLOB_PATHSPECS="1""# ) ,
197197 ] {
198198 let ctx = Context {
199199 glob_pathspecs : Some ( value) ,
@@ -305,7 +305,7 @@ mod prepare {
305305 #[ test]
306306 fn single_and_complex_arguments_as_part_of_command_with_shell ( ) {
307307 let cmd = std:: process:: Command :: from (
308- gix_command:: prepare ( "ls --foo \ " a b\" " )
308+ gix_command:: prepare ( r# "ls --foo "a b""# )
309309 . arg ( "additional" )
310310 . command_may_be_shell_script ( ) ,
311311 ) ;
@@ -324,7 +324,7 @@ mod prepare {
324324 #[ test]
325325 fn single_and_complex_arguments_with_auto_split ( ) {
326326 let cmd = std:: process:: Command :: from (
327- gix_command:: prepare ( "ls --foo=\ " a b\" " ) . command_may_be_shell_script_allow_manual_argument_splitting ( ) ,
327+ gix_command:: prepare ( r# "ls --foo="a b""# ) . command_may_be_shell_script_allow_manual_argument_splitting ( ) ,
328328 ) ;
329329 assert_eq ! (
330330 format!( "{cmd:?}" ) ,
@@ -336,7 +336,7 @@ mod prepare {
336336 #[ test]
337337 fn single_and_complex_arguments_without_auto_split ( ) {
338338 let cmd = std:: process:: Command :: from (
339- gix_command:: prepare ( "ls --foo=\ " a b\" " ) . command_may_be_shell_script_disallow_manual_argument_splitting ( ) ,
339+ gix_command:: prepare ( r# "ls --foo="a b""# ) . command_may_be_shell_script_disallow_manual_argument_splitting ( ) ,
340340 ) ;
341341 assert_eq ! ( format!( "{cmd:?}" ) , quoted( & [ * SH , "-c" , r#"ls --foo=\"a b\""# , "--" ] ) ) ;
342342 }
@@ -351,7 +351,7 @@ mod prepare {
351351 ) ;
352352 assert_eq ! (
353353 format!( "{cmd:?}" ) ,
354- quoted( & [ * SH , "-c" , "ls \\ \ " $@\\ \" " , "--" , "--foo=a b" ] )
354+ quoted( & [ * SH , "-c" , r# "ls \"$@\""# , "--" , "--foo=a b" ] )
355355 ) ;
356356 }
357357
@@ -366,15 +366,15 @@ mod prepare {
366366 ) ;
367367 assert_eq ! (
368368 format!( "{cmd:?}" ) ,
369- quoted( & [ * SH , "-c" , " \\ 'ls\\ ' \\ \ " $@\\ \" " , "--" , "--foo=a b" ] ) ,
369+ quoted( & [ * SH , "-c" , r#"\ 'ls\' \"$@\""# , "--" , "--foo=a b" ] ) ,
370370 "looks strange thanks to debug printing, but is the right amount of quotes actually"
371371 ) ;
372372 }
373373
374374 #[ test]
375375 fn quoted_windows_command_without_argument_splitting ( ) {
376376 let cmd = std:: process:: Command :: from (
377- gix_command:: prepare ( "C:\\ Users\\ O'Shaughnessy\ \ with space.exe" )
377+ gix_command:: prepare ( r "C:\Users\O'Shaughnessy\with space.exe")
378378 . arg ( "--foo='a b'" )
379379 . command_may_be_shell_script_disallow_manual_argument_splitting ( )
380380 . with_shell ( )
@@ -385,9 +385,9 @@ mod prepare {
385385 quoted( & [
386386 * SH ,
387387 "-c" ,
388- " \\ 'C:\\ \\ Users\\ \\ O \\ '\\ \\ \\ ' \\ 'Shaughnessy\\ \\ with space.exe\\ ' \\ \ " $@\\ \" " ,
388+ r#"\ 'C:\\Users\\O\ '\\\'\ 'Shaughnessy\\with space.exe\' \"$@\""# ,
389389 "--" ,
390- "--foo=\\ 'a b\ \ '"
390+ r "--foo=\'a b\'"
391391 ] ) ,
392392 "again, a lot of extra backslashes, but it's correct outside of the debug formatting"
393393 ) ;
@@ -409,7 +409,7 @@ mod prepare {
409409 #[ test]
410410 fn tilde_path_and_multiple_arguments_as_part_of_command_with_shell ( ) {
411411 let cmd =
412- std:: process:: Command :: from ( gix_command:: prepare ( "~/bin/exe --foo \ " a b\" " ) . command_may_be_shell_script ( ) ) ;
412+ std:: process:: Command :: from ( gix_command:: prepare ( r# "~/bin/exe --foo "a b""# ) . command_may_be_shell_script ( ) ) ;
413413 let sh = * SH ;
414414 assert_eq ! (
415415 format!( "{cmd:?}" ) ,
@@ -421,7 +421,7 @@ mod prepare {
421421 #[ test]
422422 fn script_with_dollar_at ( ) {
423423 let cmd = std:: process:: Command :: from (
424- gix_command:: prepare ( "echo \ " $@\ " >&2" )
424+ gix_command:: prepare ( r# "echo "$@" >&2"# )
425425 . command_may_be_shell_script ( )
426426 . arg ( "store" ) ,
427427 ) ;
@@ -437,7 +437,7 @@ mod prepare {
437437 #[ test]
438438 fn script_with_dollar_at_has_no_quoting ( ) {
439439 let cmd = std:: process:: Command :: from (
440- gix_command:: prepare ( "echo \ " $@\ " >&2" )
440+ gix_command:: prepare ( r# "echo "$@" >&2"# )
441441 . command_may_be_shell_script ( )
442442 . with_quoted_command ( )
443443 . arg ( "store" ) ,
@@ -487,7 +487,7 @@ mod spawn {
487487 #[ test]
488488 fn script_with_dollar_at ( ) -> crate :: Result {
489489 let out = std:: process:: Command :: from (
490- gix_command:: prepare ( "echo \ " $@\" " )
490+ gix_command:: prepare ( r# "echo "$@""# )
491491 . command_may_be_shell_script ( )
492492 . arg ( "arg" ) ,
493493 )
0 commit comments