aboutsummaryrefslogtreecommitdiff
path: root/src/test/run-pass/lib-io.rs
blob: 7102c91e36e32cdac1e7ed967295d3991c7ec9f0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// xfail-boot
// xfail-stage0
// -*- rust -*-

use std;
import std.io;
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;

  {
    let io.writer out = io.file_writer(tmpfile, vec(io.create));
    out.write_str(frood);
  }

  let io.reader inp = io.file_reader(tmpfile);
  let str frood2 = inp.read_c_str();
  log frood2;
  check (_str.eq(frood, frood2));
}

fn main(vec[str] argv) {
  test_simple(argv.(0));
}