[libcxx-commits] [PATCH] D148641: [libc++] Add C++20 stringstream::view()

Mark de Wever via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 27 23:10:23 PDT 2023


Mordante added a comment.

In D148641#4302726 <https://reviews.llvm.org/D148641#4302726>, @pfusik wrote:

> Thanks!
>
> How do I run C++03 tests locally?

Using the argument `-Dstd=c++03` for lit.



================
Comment at: libcxx/test/std/input.output/string.streams/istringstream/istringstream.members/str.pass.cpp:14
 
 // void str(const basic_string<charT,traits,Allocator>& s);
 
----------------
pfusik wrote:
> Mordante wrote:
> > Please create a new test for the view (can be a copy past of this file) and update the synopsis here.
> > 
> > That test will need an `// UNSUPPORTED: c++03, c++11, c++14, c++17` line since it is C++20 only.
> That would be four tests copied. Why not `#if` ?
Using a different way makes it harder to find the proper test. When the `view` test is in `str` I can't find it and assume it's untested.

The tests you made are not complete for `view` you need to test whether it's a `const` member and `noexcept` so the number of `#ifdef`s will grow.

For real code duplication is bad, for tests it's not always bad to have duplication. For test easy to understand is more important.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D148641



More information about the libcxx-commits mailing list