@@ -31,7 +31,6 @@ use treemap::TreeMap;
31
31
use std:: clone:: Clone ;
32
32
use std:: comm:: { stream, SharedChan , GenericPort , GenericChan } ;
33
33
use std:: libc;
34
- use std:: either;
35
34
use std:: io;
36
35
use std:: result;
37
36
use std:: task;
@@ -127,8 +126,8 @@ pub type MetricDiff = TreeMap<~str,MetricChange>;
127
126
pub fn test_main ( args : & [ ~str ] , tests : ~[ TestDescAndFn ] ) {
128
127
let opts =
129
128
match parse_opts ( args) {
130
- either :: Left ( o) => o,
131
- either :: Right ( m ) => fail ! ( m )
129
+ Ok ( o) => o,
130
+ Err ( msg ) => fail ! ( msg )
132
131
} ;
133
132
if !run_tests_console ( & opts, tests) { fail ! ( "Some tests failed" ) ; }
134
133
}
@@ -169,7 +168,7 @@ pub struct TestOpts {
169
168
logfile : Option < Path >
170
169
}
171
170
172
- type OptRes = Either < TestOpts , ~str > ;
171
+ type OptRes = Result < TestOpts , ~str > ;
173
172
174
173
fn optgroups ( ) -> ~[ getopts:: groups:: OptGroup ] {
175
174
~[ groups:: optflag ( "" , "ignored" , "Run ignored tests" ) ,
@@ -228,7 +227,7 @@ pub fn parse_opts(args: &[~str]) -> OptRes {
228
227
let matches =
229
228
match groups:: getopts ( args_, optgroups ( ) ) {
230
229
Ok ( m) => m,
231
- Err ( f) => return either :: Right ( getopts:: fail_str ( f) )
230
+ Err ( f) => return Err ( getopts:: fail_str ( f) )
232
231
} ;
233
232
234
233
if getopts:: opt_present ( & matches, "h" ) { usage ( args[ 0 ] , "h" ) ; }
@@ -274,7 +273,7 @@ pub fn parse_opts(args: &[~str]) -> OptRes {
274
273
logfile : logfile
275
274
} ;
276
275
277
- either :: Left ( test_opts)
276
+ Ok ( test_opts)
278
277
}
279
278
280
279
pub fn opt_shard ( maybestr : Option < ~str > ) -> Option < ( uint , uint ) > {
@@ -1155,7 +1154,6 @@ mod tests {
1155
1154
StaticTestName , DynTestName , DynTestFn } ;
1156
1155
use test:: { TestOpts , run_test} ;
1157
1156
1158
- use std:: either;
1159
1157
use std:: comm:: { stream, SharedChan } ;
1160
1158
use tempfile;
1161
1159
use std:: os;
@@ -1236,8 +1234,8 @@ mod tests {
1236
1234
fn first_free_arg_should_be_a_filter ( ) {
1237
1235
let args = ~[ ~"progname", ~"filter"] ;
1238
1236
let opts = match parse_opts ( args) {
1239
- either :: Left ( o) => o,
1240
- _ => fail ! ( "Malformed arg in first_free_arg_should_be_a_filter" )
1237
+ Ok ( o) => o,
1238
+ _ => fail ! ( "Malformed arg in first_free_arg_should_be_a_filter" )
1241
1239
} ;
1242
1240
assert ! ( "filter" == opts. filter. clone( ) . unwrap( ) ) ;
1243
1241
}
@@ -1246,8 +1244,8 @@ mod tests {
1246
1244
fn parse_ignored_flag ( ) {
1247
1245
let args = ~[ ~"progname", ~"filter", ~"--ignored"] ;
1248
1246
let opts = match parse_opts ( args) {
1249
- either :: Left ( o) => o,
1250
- _ => fail ! ( "Malformed arg in parse_ignored_flag" )
1247
+ Ok ( o) => o,
1248
+ _ => fail ! ( "Malformed arg in parse_ignored_flag" )
1251
1249
} ;
1252
1250
assert ! ( ( opts. run_ignored) ) ;
1253
1251
}
0 commit comments