@@ -417,23 +417,20 @@ mod test {
417
417
418
418
use super :: { FileInput , make_path_option_vec, input_vec, input_vec_state} ;
419
419
420
- use std:: rt:: io;
421
- use std:: rt:: io:: Writer ;
422
- use std:: rt:: io:: file;
420
+ use std:: io;
423
421
use std:: uint;
424
422
use std:: vec;
425
423
426
424
fn make_file ( path : & Path , contents : & [ ~str ] ) {
427
- let mut file = file :: open ( path, io:: CreateOrTruncate , io:: Write ) . unwrap ( ) ;
425
+ let file = io :: file_writer ( path, [ io:: Create , io:: Truncate ] ) . unwrap ( ) ;
428
426
429
427
for str in contents. iter ( ) {
430
- file. write ( str. as_bytes ( ) ) ;
431
- file. write ( [ '\n' as u8 ] ) ;
428
+ file. write_str ( * str) ;
429
+ file. write_char ( '\n' ) ;
432
430
}
433
431
}
434
432
435
433
#[ test]
436
- #[ ignore( cfg( windows) ) ] // FIXME(#8810): rt::io::file and windows don't agree
437
434
fn test_make_path_option_vec ( ) {
438
435
let strs = [ ~"some/path",
439
436
~"some/other/path"] ;
@@ -448,7 +445,6 @@ mod test {
448
445
}
449
446
450
447
#[test]
451
- #[ignore(cfg(windows))] // FIXME(#8810): rt::io::file and windows don't agree
452
448
fn test_fileinput_read_byte() {
453
449
let filenames = make_path_option_vec(vec::from_fn(
454
450
3,
@@ -479,7 +475,6 @@ mod test {
479
475
}
480
476
481
477
#[test]
482
- #[ignore(cfg(windows))] // FIXME(#8810): rt::io::file and windows don't agree
483
478
fn test_fileinput_read() {
484
479
let filenames = make_path_option_vec(vec::from_fn(
485
480
3,
@@ -500,7 +495,6 @@ mod test {
500
495
}
501
496
502
497
#[ test]
503
- #[ ignore( cfg( windows) ) ] // FIXME(#8810): rt::io::file and windows don't agree
504
498
fn test_input_vec( ) {
505
499
let mut all_lines = ~[ ] ;
506
500
let filenames = make_path_option_vec( vec:: from_fn(
@@ -524,7 +518,6 @@ mod test {
524
518
}
525
519
526
520
#[ test]
527
- #[ ignore( cfg( windows) ) ] // FIXME(#8810): rt::io::file and windows don't agree
528
521
fn test_input_vec_state( ) {
529
522
let filenames = make_path_option_vec( vec:: from_fn(
530
523
3 ,
@@ -547,7 +540,6 @@ mod test {
547
540
}
548
541
549
542
#[ test]
550
- #[ ignore( cfg( windows) ) ] // FIXME(#8810): rt::io::file and windows don't agree
551
543
fn test_empty_files( ) {
552
544
let filenames = make_path_option_vec( vec:: from_fn(
553
545
3 ,
@@ -572,21 +564,18 @@ mod test {
572
564
}
573
565
574
566
#[test]
575
- #[ignore(cfg(windows))] // FIXME(#8810): rt::io::file and windows don't agree
576
567
fn test_no_trailing_newline() {
577
568
let f1 =
578
569
Some(Path(" tmp/lib-fileinput-test-no-trailing-newline-1 . tmp"));
579
570
let f2 =
580
571
Some(Path(" tmp/lib-fileinput-test-no-trailing-newline-2 . tmp"));
581
572
582
- {
583
- let mut wr = file::open(f1.get_ref(), io::CreateOrTruncate,
584
- io::Write).unwrap();
585
- wr.write(" 1 \n 2 ".as_bytes());
586
- let mut wr = file::open(f2.get_ref(), io::CreateOrTruncate,
587
- io::Write).unwrap();
588
- wr.write(" 3 \n 4 ".as_bytes());
589
- }
573
+ let wr = io::file_writer(f1.get_ref(),
574
+ [io::Create, io::Truncate]).unwrap();
575
+ wr.write_str(" 1 \n 2 ");
576
+ let wr = io::file_writer(f2.get_ref(),
577
+ [io::Create, io::Truncate]).unwrap();
578
+ wr.write_str(" 3 \n 4 ");
590
579
591
580
let mut lines = ~[];
592
581
do input_vec(~[f1, f2]) |line| {
@@ -598,7 +587,6 @@ mod test {
598
587
599
588
600
589
#[test]
601
- #[ignore(cfg(windows))] // FIXME(#8810): rt::io::file and windows don't agree
602
590
fn test_next_file() {
603
591
let filenames = make_path_option_vec(vec::from_fn(
604
592
3,
@@ -630,7 +618,6 @@ mod test {
630
618
631
619
#[test]
632
620
#[should_fail]
633
- #[ignore(cfg(windows))] // FIXME(#8810): rt::io::file and windows don't agree
634
621
fn test_input_vec_missing_file() {
635
622
do input_vec(make_path_option_vec([~" this/file/doesnt/exist" ] , true ) ) |line| {
636
623
println( line) ;
0 commit comments