2010-08-20 12:57:38 -07:00
|
|
|
// -*- rust -*-
|
|
|
|
|
|
|
|
use std;
|
2011-05-12 17:24:54 +02:00
|
|
|
import std::io;
|
2011-05-17 20:41:41 +02:00
|
|
|
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-16 18:21:22 -07:00
|
|
|
let io::writer out = io::file_writer(tmpfile, [io::create]);
|
2011-04-13 12:05:04 -07:00
|
|
|
out.write_str(frood);
|
2010-08-20 12:57:38 -07:00
|
|
|
}
|
|
|
|
|
2011-05-12 17:24:54 +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-17 20:41:41 +02:00
|
|
|
assert (str::eq(frood, frood2));
|
2010-08-20 12:57:38 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main(vec[str] argv) {
|
|
|
|
test_simple(argv.(0));
|
|
|
|
}
|