提交 06a60054 编写于 作者: B Brian Anderson

Use correct win file open constants, per MinGW

上级 a0a2cee8
...@@ -32,12 +32,12 @@ mod libc_constants { ...@@ -32,12 +32,12 @@ mod libc_constants {
fn O_RDONLY() -> int { ret 0; } fn O_RDONLY() -> int { ret 0; }
fn O_WRONLY() -> int { ret 1; } fn O_WRONLY() -> int { ret 1; }
fn O_RDWR() -> int { ret 2; } fn O_RDWR() -> int { ret 2; }
fn O_APPEND() -> int { ret 1024; } fn O_APPEND() -> int { ret 0x0008; }
fn O_CREAT() -> int { ret 64; } fn O_CREAT() -> int { ret 0x0100; }
fn O_EXCL() -> int { ret 128; } fn O_EXCL() -> int { ret 0x0400; }
fn O_TRUNC() -> int { ret 512; } fn O_TRUNC() -> int { ret 0x0200; }
fn O_TEXT() -> int { ret 16384; } fn O_TEXT() -> int { ret 0x4000; }
fn O_BINARY() -> int { ret 32768; } fn O_BINARY() -> int { ret 0x8000; }
fn S_IRUSR() -> uint { fn S_IRUSR() -> uint {
ret 256u; // really _S_IREAD in win32 ret 256u; // really _S_IREAD in win32
......
// xfail-stage0 // xfail-stage0
// xfail-stage1
// xfail-stage2
// -*- rust -*- // -*- rust -*-
use std; use std;
import std::io; import std::io;
import std::str; import std::str;
fn test_simple(str tmpfilebase) { fn test_simple() {
let str tmpfile = tmpfilebase + ".tmp"; let str tmpfile = "test/run-pass/lib-io-test-simple.tmp";
log tmpfile; log tmpfile;
let str frood = "A hoopy frood who really knows where his towel is."; let str frood = "A hoopy frood who really knows where his towel is.";
log frood; log frood;
{ {
let io::writer out = io::file_writer(tmpfile, [io::create]); let io::writer out = io::file_writer(tmpfile, [io::create,
io::truncate]);
out.write_str(frood); out.write_str(frood);
} }
let io::reader inp = io::file_reader(tmpfile); let io::reader inp = io::file_reader(tmpfile);
...@@ -23,4 +20,6 @@ fn test_simple(str tmpfilebase) { ...@@ -23,4 +20,6 @@ fn test_simple(str tmpfilebase) {
assert (str::eq(frood, frood2)); assert (str::eq(frood, frood2));
} }
fn main(vec[str] argv) { test_simple(argv.(0)); } fn main() {
\ No newline at end of file test_simple();
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册