2011-03-25 12:19:20 -07:00
|
|
|
// xfail-boot
|
2011-04-29 16:55:24 -07:00
|
|
|
// xfail-stage0
|
2011-05-03 18:13:51 -07:00
|
|
|
// xfail-stage1
|
|
|
|
// xfail-stage2
|
2010-08-20 12:57:38 -07:00
|
|
|
// -*- rust -*-
|
|
|
|
|
|
|
|
use std;
|
2011-05-06 22:13:13 +02:00
|
|
|
import std.IO;
|
|
|
|
import std.Str;
|
2010-08-20 12:57:38 -07: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-06 22:13:13 +02:00
|
|
|
let IO.writer out = IO.file_writer(tmpfile, vec(IO.create));
|
2011-04-13 12:05:04 -07:00
|
|
|
out.write_str(frood);
|
2010-08-20 12:57:38 -07:00
|
|
|
}
|
|
|
|
|
2011-05-06 22:13:13 +02:00
|
|
|
let IO.reader inp = IO.file_reader(tmpfile);
|
2011-04-13 12:05:04 -07:00
|
|
|
let str frood2 = inp.read_c_str();
|
2010-08-20 12:57:38 -07:00
|
|
|
log frood2;
|
2011-05-06 22:13:13 +02:00
|
|
|
assert (Str.eq(frood, frood2));
|
2010-08-20 12:57:38 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main(vec[str] argv) {
|
|
|
|
test_simple(argv.(0));
|
|
|
|
}
|