@@ -41,6 +41,8 @@ fn test_read_write() {
41
41
// value -1.
42
42
let mut buf: [ u8 ; 8 ] = [ 0 ; 8 ] ;
43
43
let res = read_bytes ( fd, & mut buf) ;
44
+ let e = std:: io:: Error :: last_os_error ( ) ;
45
+ assert_eq ! ( e. raw_os_error( ) , Some ( libc:: EAGAIN ) ) ;
44
46
assert_eq ! ( res, -1 ) ;
45
47
46
48
// Write with supplied buffer bigger than 8 bytes should be allowed.
@@ -58,12 +60,16 @@ fn test_read_write() {
58
60
// value -1.
59
61
let mut buf: [ u8 ; 7 ] = [ 1 ; 7 ] ;
60
62
let res = read_bytes ( fd, & mut buf) ;
63
+ let e = std:: io:: Error :: last_os_error ( ) ;
64
+ assert_eq ! ( e. raw_os_error( ) , Some ( libc:: EINVAL ) ) ;
61
65
assert_eq ! ( res, -1 ) ;
62
66
63
67
// Write with supplied buffer smaller than 8 bytes should fail with return
64
68
// value -1.
65
69
let size_7_data: [ u8 ; 7 ] = [ 1 ; 7 ] ;
66
70
let res = write_bytes ( fd, size_7_data) ;
71
+ let e = std:: io:: Error :: last_os_error ( ) ;
72
+ assert_eq ! ( e. raw_os_error( ) , Some ( libc:: EINVAL ) ) ;
67
73
assert_eq ! ( res, -1 ) ;
68
74
69
75
// Read with supplied buffer bigger than 8 bytes should be allowed.
@@ -74,6 +80,8 @@ fn test_read_write() {
74
80
// Write u64::MAX should fail.
75
81
let u64_max_bytes: [ u8 ; 8 ] = [ 255 ; 8 ] ;
76
82
let res = write_bytes ( fd, u64_max_bytes) ;
83
+ let e = std:: io:: Error :: last_os_error ( ) ;
84
+ assert_eq ! ( e. raw_os_error( ) , Some ( libc:: EINVAL ) ) ;
77
85
assert_eq ! ( res, -1 ) ;
78
86
}
79
87
0 commit comments