@@ -17,7 +17,8 @@ fn is_terminal() {
1717 } ) ) ;
1818
1919 let mut terminal = Terminal :: spawn ( ScreenSize { rows : 80 , cols : 80 } , cmd) . unwrap ( ) ;
20- let output = terminal. read_to_end ( ) . unwrap ( ) ;
20+ terminal. read_to_end ( ) . unwrap ( ) ;
21+ let output = terminal. screen_contents ( ) ;
2122 assert_eq ! ( output. trim( ) , "true true true" ) ;
2223}
2324
@@ -30,7 +31,8 @@ fn read_until_single() {
3031
3132 let mut terminal = Terminal :: spawn ( ScreenSize { rows : 80 , cols : 80 } , cmd) . unwrap ( ) ;
3233 terminal. read_until ( "hello" ) . unwrap ( ) ;
33- let output = terminal. read_to_end ( ) . unwrap ( ) ;
34+ terminal. read_to_end ( ) . unwrap ( ) ;
35+ let output = terminal. screen_contents ( ) ;
3436 // After reading until "hello", the buffer should contain " world"
3537 // read_to_end should process the buffered data and continue reading
3638 assert ! ( output. contains( "world" ) ) ;
@@ -49,7 +51,8 @@ fn read_until_multiple_sequential() {
4951 terminal. read_until ( "first" ) . unwrap ( ) ;
5052 terminal. read_until ( "second" ) . unwrap ( ) ;
5153 terminal. read_until ( "third" ) . unwrap ( ) ;
52- let output = terminal. read_to_end ( ) . unwrap ( ) ;
54+ terminal. read_to_end ( ) . unwrap ( ) ;
55+ let output = terminal. screen_contents ( ) ;
5356 // All three words should be in the screen
5457 assert ! ( output. contains( "first" ) ) ;
5558 assert ! ( output. contains( "second" ) ) ;
@@ -83,7 +86,8 @@ fn read_until_with_read_to_end() {
8386 let mut terminal = Terminal :: spawn ( ScreenSize { rows : 80 , cols : 80 } , cmd) . unwrap ( ) ;
8487 terminal. read_until ( "middle" ) . unwrap ( ) ;
8588 // At this point, " suffix" should be buffered
86- let output = terminal. read_to_end ( ) . unwrap ( ) ;
89+ terminal. read_to_end ( ) . unwrap ( ) ;
90+ let output = terminal. screen_contents ( ) ;
8791 // The full output should include everything
8892 assert ! ( output. contains( "prefix" ) ) ;
8993 assert ! ( output. contains( "middle" ) ) ;
@@ -118,7 +122,8 @@ fn read_until_boundary_spanning() {
118122 let mut terminal = Terminal :: spawn ( ScreenSize { rows : 80 , cols : 80 } , cmd) . unwrap ( ) ;
119123 // Search for a pattern that's likely to span boundaries
120124 terminal. read_until ( "abcd" ) . unwrap ( ) ;
121- let output = terminal. read_to_end ( ) . unwrap ( ) ;
125+ terminal. read_to_end ( ) . unwrap ( ) ;
126+ let output = terminal. screen_contents ( ) ;
122127 assert ! ( output. contains( "abcdef" ) ) ;
123128}
124129
@@ -137,7 +142,8 @@ fn read_until_exact_boundary() {
137142 let mut terminal = Terminal :: spawn ( ScreenSize { rows : 80 , cols : 80 } , cmd) . unwrap ( ) ;
138143 // This should find "second" even if "first" was in a previous read
139144 terminal. read_until ( "second" ) . unwrap ( ) ;
140- let output = terminal. read_to_end ( ) . unwrap ( ) ;
145+ terminal. read_to_end ( ) . unwrap ( ) ;
146+ let output = terminal. screen_contents ( ) ;
141147 assert ! ( output. contains( "first" ) ) ;
142148 assert ! ( output. contains( "second" ) ) ;
143149}
@@ -156,7 +162,8 @@ fn read_until_after_read_to_end() {
156162 terminal. read_until ( "world" ) . unwrap ( ) ;
157163
158164 // Read everything else
159- let output = terminal. read_to_end ( ) . unwrap ( ) ;
165+ terminal. read_to_end ( ) . unwrap ( ) ;
166+ let output = terminal. screen_contents ( ) ;
160167 assert ! ( output. contains( "hello world foo bar" ) ) ;
161168
162169 // After read_to_end, buffer is empty and we're at EOF
0 commit comments