@@ -65,7 +65,7 @@ fn test_ioerror() {
65
65
assert_eq ! ( "uh-oh!" , read_and_validate( & mut b) . unwrap_err( ) . to_string( ) ) ;
66
66
}
67
67
68
- #[ derive( PartialEq , Debug ) ]
68
+ #[ derive( PartialEq , Debug ) ]
69
69
struct PositiveNonzeroInteger ( u64 ) ;
70
70
71
71
impl PositiveNonzeroInteger {
@@ -83,11 +83,14 @@ impl PositiveNonzeroInteger {
83
83
#[ test]
84
84
fn test_positive_nonzero_integer_creation ( ) {
85
85
assert ! ( PositiveNonzeroInteger :: new( 10 ) . is_ok( ) ) ;
86
- assert_eq ! ( Err ( CreationError :: Negative ) , PositiveNonzeroInteger :: new( -10 ) ) ;
86
+ assert_eq ! (
87
+ Err ( CreationError :: Negative ) ,
88
+ PositiveNonzeroInteger :: new( -10 )
89
+ ) ;
87
90
assert_eq ! ( Err ( CreationError :: Zero ) , PositiveNonzeroInteger :: new( 0 ) ) ;
88
91
}
89
92
90
- #[ derive( PartialEq , Debug ) ]
93
+ #[ derive( PartialEq , Debug ) ]
91
94
enum CreationError {
92
95
Negative ,
93
96
Zero ,
@@ -108,6 +111,36 @@ impl error::Error for CreationError {
108
111
}
109
112
}
110
113
114
+
115
+
116
+
117
+
118
+
119
+
120
+
121
+
122
+
123
+
124
+
125
+
126
+
127
+
128
+
129
+
130
+
131
+
132
+
133
+
134
+
135
+
136
+
137
+
138
+
139
+
140
+
141
+
142
+
143
+
111
144
// First hint: To figure out what type should go where the ??? is, take a look
112
145
// at the test helper function `test_with_str`, since it returns whatever
113
146
// `read_and_validate` returns and`test_with_str` has its signature fully
0 commit comments