2011-03-25 14:19:20 -05:00
|
|
|
// xfail-boot
|
|
|
|
// xfail-stage0
|
2010-08-20 14:57:38 -05:00
|
|
|
// -*- rust -*-
|
|
|
|
|
|
|
|
use std;
|
2011-02-22 17:58:07 -06:00
|
|
|
import std.io;
|
2010-08-20 14:57:38 -05:00
|
|
|
import std._str;
|
|
|
|
|
|
|
|
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-03-06 12:51:42 -06:00
|
|
|
let io.buf_writer out = io.new_buf_writer(tmpfile, vec(io.create));
|
2010-08-20 14:57:38 -05:00
|
|
|
out.write(_str.bytes(frood));
|
|
|
|
}
|
|
|
|
|
2011-02-22 17:58:07 -06:00
|
|
|
let io.buf_reader inp = io.new_buf_reader(tmpfile);
|
2010-08-20 14:57:38 -05:00
|
|
|
let str frood2 = _str.from_bytes(inp.read());
|
|
|
|
log frood2;
|
|
|
|
check (_str.eq(frood, frood2));
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main(vec[str] argv) {
|
|
|
|
test_simple(argv.(0));
|
|
|
|
}
|