From 11b3b5128e7656eb216f62593876589245a39d35 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Mon, 28 Apr 2014 20:04:59 -0700 Subject: [PATCH] Fix test when the output file exists. --- format-test.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/format-test.cc b/format-test.cc index a38c18b0..d0ff60e5 100644 --- a/format-test.cc +++ b/format-test.cc @@ -50,6 +50,7 @@ # include # define O_WRONLY _O_WRONLY # define O_CREAT _O_CREAT +# define O_TRUNC _O_TRUNC # define S_IRUSR _S_IREAD # define S_IWUSR _S_IWRITE # define open _open @@ -1658,7 +1659,7 @@ TEST(FormatTest, PrintColored) { File saved_stdio(dup(1)); EXPECT_NE(-1, saved_stdio.fd()); { - File out(open("out", O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR)); + File out(open("out", O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)); EXPECT_NE(-1, out.fd()); EXPECT_NE(-1, dup2(out.fd(), 1)); }