[libcxx-commits] [PATCH] D154489: [libc++][tests] Fix a test exercising incorrect overload

Piotr Fusik via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 10 12:41:49 PDT 2023


pfusik updated this revision to Diff 549144.
pfusik added a comment.

Rebased. Added testing with `test_allocator`.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D154489/new/

https://reviews.llvm.org/D154489

Files:
  libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.cons/string.move.mode.pass.cpp


Index: libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.cons/string.move.mode.pass.cpp
===================================================================
--- libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.cons/string.move.mode.pass.cpp
+++ libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.cons/string.move.mode.pass.cpp
@@ -29,13 +29,23 @@
 static void test() {
   {
     std::basic_string<CharT> s(STR("testing"));
-    const std::basic_stringbuf<CharT, std::char_traits<CharT>, test_allocator<CharT>> buf(std::move(s));
+    const std::basic_stringbuf<CharT> buf(std::move(s));
     assert(buf.view() == SV("testing"));
   }
   {
     std::basic_string<CharT> s(STR("testing"));
+    const std::basic_stringbuf<CharT> buf(std::move(s), std::ios_base::out);
+    assert(buf.view() == SV("testing"));
+  }
+  {
+    std::basic_string<CharT, std::char_traits<CharT>, test_allocator<CharT>> s(STR("testing"));
+    const std::basic_stringbuf<CharT, std::char_traits<CharT>, test_allocator<CharT>> buf(std::move(s));
+    assert(buf.view() == SV("testing"));
+  }
+  {
+    std::basic_string<CharT, std::char_traits<CharT>, test_allocator<CharT>> s(STR("testing"));
     const std::basic_stringbuf<CharT, std::char_traits<CharT>, test_allocator<CharT>> buf(
-        std::move(s), std::ios_base::out);
+        std::move(s), std::ios_base::in);
     assert(buf.view() == SV("testing"));
   }
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154489.549144.patch
Type: text/x-patch
Size: 1440 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230810/4d0e3d6c/attachment-0001.bin>


More information about the libcxx-commits mailing list