2011-06-02 10:58:49 -05:00
|
|
|
// xfail-stage0
|
|
|
|
// xfail-stage1
|
|
|
|
// xfail-stage2
|
2010-08-20 14:57:38 -05:00
|
|
|
// -*- rust -*-
|
|
|
|
|
|
|
|
use std;
|
2011-05-12 10:24:54 -05:00
|
|
|
import std::io;
|
2011-05-17 13:41:41 -05:00
|
|
|
import std::str;
|
2010-08-20 14:57:38 -05:00
|
|
|
|
|
|
|
fn test_simple(str tmpfilebase) {
|
|
|
|
let str tmpfile = tmpfilebase + ".tmp";
|
|
|
|
log tmpfile;
|
|
|
|
let str frood = "A hoopy frood who really knows where his towel is.";
|
|
|
|
log frood;
|
|
|
|
|
|
|
|
{
|
2011-05-16 20:21:22 -05:00
|
|
|
let io::writer out = io::file_writer(tmpfile, [io::create]);
|
2011-04-13 14:05:04 -05:00
|
|
|
out.write_str(frood);
|
2010-08-20 14:57:38 -05:00
|
|
|
}
|
|
|
|
|
2011-05-12 10:24:54 -05:00
|
|
|
let io::reader inp = io::file_reader(tmpfile);
|
2011-04-13 14:05:04 -05:00
|
|
|
let str frood2 = inp.read_c_str();
|
2010-08-20 14:57:38 -05:00
|
|
|
log frood2;
|
2011-05-17 13:41:41 -05:00
|
|
|
assert (str::eq(frood, frood2));
|
2010-08-20 14:57:38 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main(vec[str] argv) {
|
|
|
|
test_simple(argv.(0));
|
|
|
|
}
|