File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -230,6 +230,28 @@ fn test_nc_0_wo_follow2() {
230230 . no_output ( ) ;
231231}
232232
233+ #[ test]
234+ #[ cfg( not( target_os = "windows" ) ) ]
235+ fn test_n0_with_follow ( ) {
236+ let ( at, mut ucmd) = at_and_ucmd ! ( ) ;
237+ let test_file = "test.txt" ;
238+ // Create file with multiple lines
239+ at. write ( test_file, "line1\n line2\n line3\n " ) ;
240+
241+ let mut child = ucmd. arg ( "-n0" ) . arg ( "-f" ) . arg ( test_file) . run_no_wait ( ) ;
242+ child. make_assertion_with_delay ( 500 ) . is_alive ( ) ;
243+
244+ // Append a new line
245+ at. append ( test_file, "new\n " ) ;
246+
247+ // Should only print the newly appended line
248+ child
249+ . make_assertion_with_delay ( DEFAULT_SLEEP_INTERVAL_MILLIS )
250+ . with_current_output ( )
251+ . stdout_only ( "new\n " ) ;
252+ child. kill ( ) ;
253+ }
254+
233255// TODO: Add similar test for windows
234256#[ test]
235257#[ cfg( unix) ]
You can’t perform that action at this time.
0 commit comments