BillyONeal created this revision.
BillyONeal added reviewers: mclow.lists, EricWF.

libc++'s tests are asserting things about the buffer passed to pubsetbuf. 
[filebuf.virtuals]/12 says that what the filebuf does with the buffer you give 
it is completely implementation defined. The MSVC++ implementation takes that 
buffer and hands it off to the CRT (by calling ::setvbuf) and the CRT doesn't 
necessarily follow the pattern this test wants.

This change simply makes asserts against the buffer's contents use 
LIBCPP_ASSERT instead of assert.


https://reviews.llvm.org/D45294

Files:
  test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp


Index: 
test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp
===================================================================
--- 
test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp
+++ 
test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp
@@ -14,11 +14,11 @@
 // pos_type seekpos(pos_type sp,
 //                  ios_base::openmode which = ios_base::in | ios_base::out);
 
-// This test is not entirely portable
-
 #include <fstream>
 #include <cassert>
 
+#include "test_macros.h"
+
 int main()
 {
     {
@@ -30,7 +30,7 @@
                                                        | std::ios_base::trunc) 
!= 0);
         assert(f.is_open());
         f.sputn("abcdefghijklmnopqrstuvwxyz", 26);
-        assert(buf[0] == 'v');
+        LIBCPP_ASSERT(buf[0] == 'v');
         pos_type p = f.pubseekoff(-15, std::ios_base::cur);
         assert(p == 11);
         assert(f.sgetc() == 'l');
@@ -51,7 +51,7 @@
                                                        | std::ios_base::trunc) 
!= 0);
         assert(f.is_open());
         f.sputn(L"abcdefghijklmnopqrstuvwxyz", 26);
-        assert(buf[0] == L'v');
+        LIBCPP_ASSERT(buf[0] == L'v');
         pos_type p = f.pubseekoff(-15, std::ios_base::cur);
         assert(p == 11);
         assert(f.sgetc() == L'l');


Index: test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp
===================================================================
--- test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp
+++ test/std/input.output/file.streams/fstreams/filebuf.virtuals/seekoff.pass.cpp
@@ -14,11 +14,11 @@
 // pos_type seekpos(pos_type sp,
 //                  ios_base::openmode which = ios_base::in | ios_base::out);
 
-// This test is not entirely portable
-
 #include <fstream>
 #include <cassert>
 
+#include "test_macros.h"
+
 int main()
 {
     {
@@ -30,7 +30,7 @@
                                                        | std::ios_base::trunc) != 0);
         assert(f.is_open());
         f.sputn("abcdefghijklmnopqrstuvwxyz", 26);
-        assert(buf[0] == 'v');
+        LIBCPP_ASSERT(buf[0] == 'v');
         pos_type p = f.pubseekoff(-15, std::ios_base::cur);
         assert(p == 11);
         assert(f.sgetc() == 'l');
@@ -51,7 +51,7 @@
                                                        | std::ios_base::trunc) != 0);
         assert(f.is_open());
         f.sputn(L"abcdefghijklmnopqrstuvwxyz", 26);
-        assert(buf[0] == L'v');
+        LIBCPP_ASSERT(buf[0] == L'v');
         pos_type p = f.pubseekoff(-15, std::ios_base::cur);
         assert(p == 11);
         assert(f.sgetc() == L'l');
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D45294: [l... Billy Robert O'Neal III via Phabricator via cfe-commits

Reply via email to