Commit 91a6401 1 parent a8ffc7f commit 91a6401 Copy full SHA for 91a6401
File tree 1 file changed +11
-6
lines changed
1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -55,10 +55,9 @@ fn main() {
55
55
let b = buf[ 0 ] ; // capture buf[0]
56
56
thread:: sleep ( Duration :: from_millis ( 200 ) ) ;
57
57
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) ;
62
61
}
63
62
}
64
63
} )
@@ -71,6 +70,12 @@ fn main() {
71
70
let _ = server. write ( b"x" ) ;
72
71
thread:: sleep ( Duration :: from_millis ( 100 ) ) ;
73
72
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
+ }
76
81
}
You can’t perform that action at this time.
0 commit comments