File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -55,10 +55,9 @@ fn main() {
5555 let b = buf[ 0 ] ; // capture buf[0]
5656 thread:: sleep ( Duration :: from_millis ( 200 ) ) ;
5757
58- // In this test, success is indicated by failing.
59- if buf[ 0 ] == b {
60- panic ! ( "Success!" ) ;
61- }
58+ // Check the buffer hasn't been written to after read.
59+ dbg ! ( buf[ 0 ] , b) ;
60+ assert_eq ! ( buf[ 0 ] , b) ;
6261 }
6362 }
6463 } )
@@ -71,6 +70,12 @@ fn main() {
7170 let _ = server. write ( b"x" ) ;
7271 thread:: sleep ( Duration :: from_millis ( 100 ) ) ;
7372 let _ = server. write ( b"y" ) ;
74- let _ = t1. join ( ) ;
75- let _ = t2. join ( ) ;
73+
74+ // This is run fail because we need to test for the `abort`.
75+ // That failing to run is the success case.
76+ if t1. join ( ) . is_err ( ) || t2. join ( ) . is_err ( ) {
77+ return ;
78+ } else {
79+ panic ! ( "success" ) ;
80+ }
7681}
You can’t perform that action at this time.
0 commit comments