@@ -65,13 +65,11 @@ fn test_zero_timeout() {
6565 new_ucmd ! ( )
6666 . args ( & [ "-v" , "0" , "sleep" , ".1" ] )
6767 . succeeds ( )
68- . no_stderr ( )
69- . no_stdout ( ) ;
68+ . no_output ( ) ;
7069 new_ucmd ! ( )
7170 . args ( & [ "-v" , "0" , "-s0" , "-k0" , "sleep" , ".1" ] )
7271 . succeeds ( )
73- . no_stderr ( )
74- . no_stdout ( ) ;
72+ . no_output ( ) ;
7573}
7674
7775#[ test]
@@ -82,15 +80,27 @@ fn test_command_empty_args() {
8280 . stderr_contains ( "timeout: empty string" ) ;
8381}
8482
83+ #[ test]
84+ fn test_foreground ( ) {
85+ for arg in [ "-f" , "--foreground" ] {
86+ new_ucmd ! ( )
87+ . args ( & [ arg, ".1" , "sleep" , "10" ] )
88+ . fails ( )
89+ . code_is ( 124 )
90+ . no_output ( ) ;
91+ }
92+ }
93+
8594#[ test]
8695fn test_preserve_status ( ) {
87- new_ucmd ! ( )
88- . args ( & [ "--preserve-status" , ".1" , "sleep" , "10" ] )
89- . fails ( )
90- // 128 + SIGTERM = 128 + 15
91- . code_is ( 128 + 15 )
92- . no_stderr ( )
93- . no_stdout ( ) ;
96+ for arg in [ "-p" , "--preserve-status" ] {
97+ new_ucmd ! ( )
98+ . args ( & [ arg, ".1" , "sleep" , "10" ] )
99+ . fails ( )
100+ // 128 + SIGTERM = 128 + 15
101+ . code_is ( 128 + 15 )
102+ . no_output ( ) ;
103+ }
94104}
95105
96106#[ test]
@@ -102,8 +112,7 @@ fn test_preserve_status_even_when_send_signal() {
102112 . args ( & [ "-s" , cont_spelling, "--preserve-status" , ".1" , "sleep" , "2" ] )
103113 . succeeds ( )
104114 . code_is ( 0 )
105- . no_stderr ( )
106- . no_stdout ( ) ;
115+ . no_output ( ) ;
107116 }
108117}
109118
@@ -113,14 +122,12 @@ fn test_dont_overflow() {
113122 . args ( & [ "9223372036854775808d" , "sleep" , "0" ] )
114123 . succeeds ( )
115124 . code_is ( 0 )
116- . no_stderr ( )
117- . no_stdout ( ) ;
125+ . no_output ( ) ;
118126 new_ucmd ! ( )
119127 . args ( & [ "-k" , "9223372036854775808d" , "10" , "sleep" , "0" ] )
120128 . succeeds ( )
121129 . code_is ( 0 )
122- . no_stderr ( )
123- . no_stdout ( ) ;
130+ . no_output ( ) ;
124131}
125132
126133#[ test]
@@ -153,8 +160,7 @@ fn test_kill_after_long() {
153160 new_ucmd ! ( )
154161 . args ( & [ "--kill-after=1" , "1" , "sleep" , "0" ] )
155162 . succeeds ( )
156- . no_stdout ( )
157- . no_stderr ( ) ;
163+ . no_output ( ) ;
158164}
159165
160166#[ test]
0 commit comments