@@ -244,7 +244,7 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
244
244
None => copy * config
245
245
} ;
246
246
let config = & mut config;
247
- let cmds = str :: connect ( props. debugger_cmds , "\n " ) ;
247
+ let cmds = props. debugger_cmds . connect ( "\n " ) ;
248
248
let check_lines = copy props. check_lines ;
249
249
250
250
// compile test file (it shoud have 'compile-flags:-g' in the header)
@@ -278,7 +278,7 @@ fn run_debuginfo_test(config: &config, props: &TestProps, testfile: &Path) {
278
278
// check if each line in props.check_lines appears in the
279
279
// output (in order)
280
280
let mut i = 0 u;
281
- for str :: each_line ( ProcRes . stdout) |line| {
281
+ for ProcRes . stdout. line_iter ( ) . advance |line| {
282
282
if check_lines[ i] . trim( ) == line. trim( ) {
283
283
i += 1 u;
284
284
}
@@ -308,8 +308,8 @@ fn check_error_patterns(props: &TestProps,
308
308
let mut next_err_idx = 0 u;
309
309
let mut next_err_pat = & props. error_patterns[ next_err_idx] ;
310
310
let mut done = false ;
311
- for str :: each_line ( ProcRes . stderr) |line| {
312
- if str :: contains ( line , * next_err_pat) {
311
+ for ProcRes . stderr. line_iter ( ) . advance |line| {
312
+ if line . contains( * next_err_pat) {
313
313
debug ! ( "found error pattern %s" , * next_err_pat) ;
314
314
next_err_idx += 1 u;
315
315
if next_err_idx == props. error_patterns. len( ) {
@@ -358,15 +358,15 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
358
358
// filename:line1:col1: line2:col2: *warning:* msg
359
359
// where line1:col1: is the starting point, line2:col2:
360
360
// is the ending point, and * represents ANSI color codes.
361
- for str :: each_line ( ProcRes . stderr) |line| {
361
+ for ProcRes . stderr. line_iter ( ) . advance |line| {
362
362
let mut was_expected = false ;
363
363
for vec:: eachi( expected_errors) |i, ee| {
364
364
if !found_flags[ i] {
365
365
debug ! ( "prefix=%s ee.kind=%s ee.msg=%s line=%s" ,
366
366
prefixes[ i] , ee. kind, ee. msg, line) ;
367
- if ( str :: starts_with ( line , prefixes[ i] ) &&
368
- str :: contains ( line , ee. kind ) &&
369
- str :: contains ( line , ee. msg ) ) {
367
+ if ( line . starts_with( prefixes[ i] ) &&
368
+ line . contains( ee. kind) &&
369
+ line . contains( ee. msg) ) {
370
370
found_flags[ i] = true;
371
371
was_expected = true;
372
372
break ;
@@ -375,7 +375,7 @@ fn check_expected_errors(expected_errors: ~[errors::ExpectedError],
375
375
}
376
376
377
377
// ignore this msg which gets printed at the end
378
- if str :: contains ( line , "aborting due to" ) {
378
+ if line . contains ( "aborting due to" ) {
379
379
was_expected = true ;
380
380
}
381
381
@@ -417,7 +417,7 @@ fn scan_until_char(haystack: &str, needle: char, idx: &mut uint) -> bool {
417
417
if * idx >= haystack. len ( ) {
418
418
return false ;
419
419
}
420
- let opt = str :: find_char_from ( haystack, needle , * idx) ;
420
+ let opt = haystack. slice_from ( * idx) . find ( needle ) ;
421
421
if opt. is_none ( ) {
422
422
return false ;
423
423
}
@@ -429,7 +429,7 @@ fn scan_char(haystack: &str, needle: char, idx: &mut uint) -> bool {
429
429
if * idx >= haystack. len ( ) {
430
430
return false ;
431
431
}
432
- let range = str :: char_range_at ( haystack , * idx) ;
432
+ let range = haystack . char_range_at ( * idx) ;
433
433
if range. ch != needle {
434
434
return false ;
435
435
}
@@ -440,7 +440,7 @@ fn scan_char(haystack: &str, needle: char, idx: &mut uint) -> bool {
440
440
fn scan_integer ( haystack : & str , idx : & mut uint ) -> bool {
441
441
let mut i = * idx;
442
442
while i < haystack. len ( ) {
443
- let range = str :: char_range_at ( haystack , i) ;
443
+ let range = haystack . char_range_at ( i) ;
444
444
if range. ch < '0' || '9' < range. ch {
445
445
break ;
446
446
}
@@ -460,7 +460,7 @@ fn scan_string(haystack: &str, needle: &str, idx: &mut uint) -> bool {
460
460
if haystack_i >= haystack. len ( ) {
461
461
return false ;
462
462
}
463
- let range = str :: char_range_at ( haystack , haystack_i) ;
463
+ let range = haystack . char_range_at ( haystack_i) ;
464
464
haystack_i = range. next ;
465
465
if !scan_char ( needle, range. ch , & mut needle_i) {
466
466
return false ;
@@ -612,15 +612,11 @@ fn make_run_args(config: &config, _props: &TestProps, testfile: &Path) ->
612
612
}
613
613
614
614
fn split_maybe_args ( argstr : & Option < ~str > ) -> ~[ ~str ] {
615
- fn rm_whitespace ( v : ~[ ~str ] ) -> ~[ ~str ] {
616
- v. filtered ( |s| !str:: is_whitespace ( * s) )
617
- }
618
-
619
615
match * argstr {
620
616
Some ( ref s) => {
621
- let mut ss = ~ [ ] ;
622
- for str :: each_split_char ( * s , ' ' ) |s| { ss . push ( s. to_owned ( ) ) }
623
- rm_whitespace ( ss )
617
+ s . split_iter ( ' ' )
618
+ . filter_map ( |s| if s . is_whitespace ( ) { None } else { Some ( s. to_owned ( ) ) } )
619
+ . collect ( )
624
620
}
625
621
None => ~[ ]
626
622
}
@@ -649,13 +645,13 @@ fn program_output(config: &config, testfile: &Path, lib_path: &str, prog: ~str,
649
645
#[ cfg( target_os = "macos" ) ]
650
646
#[ cfg( target_os = "freebsd" ) ]
651
647
fn make_cmdline ( _libpath : & str , prog : & str , args : & [ ~str ] ) -> ~str {
652
- fmt ! ( "%s %s" , prog, str :: connect( args , " " ) )
648
+ fmt ! ( "%s %s" , prog, args . connect( " " ) )
653
649
}
654
650
655
651
#[ cfg( target_os = "win32" ) ]
656
652
fn make_cmdline ( libpath : & str , prog : & str , args : & [ ~str ] ) -> ~str {
657
653
fmt ! ( "%s %s %s" , lib_path_cmd_prefix( libpath) , prog,
658
- str :: connect( args , " " ) )
654
+ args . connect( " " ) )
659
655
}
660
656
661
657
// Build the LD_LIBRARY_PATH variable as it would be seen on the command line
@@ -739,8 +735,7 @@ fn _arm_exec_compiled_test(config: &config, props: &TestProps,
739
735
let cmdline = make_cmdline ( "" , args. prog , args. args ) ;
740
736
741
737
// get bare program string
742
- let mut tvec = ~[ ] ;
743
- for str:: each_split_char( args. prog, '/' ) |ts| { tvec. push ( ts. to_owned ( ) ) }
738
+ let mut tvec: ~[ ~str ] = args. prog . split_iter ( '/' ) . transform ( |ts| ts. to_owned ( ) ) . collect ( ) ;
744
739
let prog_short = tvec. pop ( ) ;
745
740
746
741
// copy to target
0 commit comments