Skip to content

Commit

Permalink
Fix posix-test on FreeBSD (#179)
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Jun 25, 2015
1 parent 761a0af commit 88c7c20
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/posix-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,11 @@ TEST(FileTest, Read) {
}

TEST(FileTest, ReadError) {
File read_end, write_end;
File::pipe(read_end, write_end);
File f("test-file", File::WRONLY);
char buf;
// We intentionally read from write_end to cause error.
EXPECT_SYSTEM_ERROR(write_end.read(&buf, 1), EBADF, "cannot read from file");
// We intentionally read from a file opened in the write-only mode to
// cause error.
EXPECT_SYSTEM_ERROR(f.read(&buf, 1), EBADF, "cannot read from file");
}

TEST(FileTest, Write) {
Expand All @@ -308,10 +308,10 @@ TEST(FileTest, Write) {
}

TEST(FileTest, WriteError) {
File read_end, write_end;
File::pipe(read_end, write_end);
// We intentionally write to read_end to cause error.
EXPECT_SYSTEM_ERROR(read_end.write(" ", 1), EBADF, "cannot write to file");
File f("test-file", File::RDONLY);
// We intentionally write to a file opened in the read-only mode to
// cause error.
EXPECT_SYSTEM_ERROR(f.write(" ", 1), EBADF, "cannot write to file");
}

TEST(FileTest, Dup) {
Expand Down

0 comments on commit 88c7c20

Please sign in to comment.