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

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 10 12:27:15 PDT 2023


ldionne added inline comments.


================
Comment at: libcxx/test/std/input.output/string.streams/stringbuf/stringbuf.cons/string.move.mode.pass.cpp:29-36
     std::basic_string<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"));
+    const std::basic_stringbuf<CharT> buf(std::move(s));
+    assert(buf.str() == STR("testing"));
   }
   {
     std::basic_string<CharT> s(STR("testing"));
+    const std::basic_stringbuf<CharT> buf(std::move(s), std::ios_base::out);
----------------
OH!! I see it now. Okay, thanks for the fix.

What would you think about testing this thought?

```
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.str() == STR("testing"));
```

It's nice to use the `test_allocator` and not just the default one.



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D154489



More information about the libcxx-commits mailing list