@@ -454,7 +454,6 @@ fn test_file_exists_and_is_regular() {
454454}
455455
456456#[ test]
457- #[ cfg( not( windows) ) ] // FIXME: implement on Windows
458457fn test_file_is_readable ( ) {
459458 new_ucmd ! ( ) . args ( & [ "-r" , "regular_file" ] ) . succeeds ( ) ;
460459}
@@ -473,7 +472,6 @@ fn test_file_is_not_readable() {
473472}
474473
475474#[ test]
476- #[ cfg( not( windows) ) ] // FIXME: implement on Windows
477475fn test_file_is_writable ( ) {
478476 new_ucmd ! ( ) . args ( & [ "-w" , "regular_file" ] ) . succeeds ( ) ;
479477}
@@ -517,7 +515,7 @@ fn test_file_is_not_executable() {
517515}
518516
519517#[ test]
520- #[ cfg( not( windows) ) ] // FIXME: implement on Windows
518+ #[ cfg( not( windows) ) ]
521519fn test_file_is_executable ( ) {
522520 let scenario = TestScenario :: new ( util_name ! ( ) ) ;
523521 let mut chmod = scenario. cmd ( "chmod" ) ;
@@ -527,6 +525,27 @@ fn test_file_is_executable() {
527525 scenario. ucmd ( ) . args ( & [ "-x" , "regular_file" ] ) . succeeds ( ) ;
528526}
529527
528+ #[ test]
529+ #[ cfg( windows) ]
530+ fn test_file_is_not_writable_windows ( ) {
531+ let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
532+ at. touch ( "readonly_file" ) ;
533+ let mut perms = std:: fs:: metadata ( at. plus ( "readonly_file" ) )
534+ . unwrap ( )
535+ . permissions ( ) ;
536+ perms. set_readonly ( true ) ;
537+ std:: fs:: set_permissions ( at. plus ( "readonly_file" ) , perms) . unwrap ( ) ;
538+ ucmd. args ( & [ "!" , "-w" , "readonly_file" ] ) . succeeds ( ) ;
539+ }
540+
541+ #[ test]
542+ #[ cfg( windows) ]
543+ fn test_file_is_executable_windows ( ) {
544+ let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
545+ at. touch ( "program.exe" ) ;
546+ ucmd. args ( & [ "-x" , "program.exe" ] ) . succeeds ( ) ;
547+ }
548+
530549#[ test]
531550fn test_is_not_empty ( ) {
532551 new_ucmd ! ( ) . args ( & [ "-s" , "non_empty_file" ] ) . succeeds ( ) ;
0 commit comments