Comparisons of basic_string_views with custom char_traits do not print out the string values

Open
#316 0 comments 0 reactions 1 assignee View on GitHub

@raffienficiaud is already working on this.

Since Feb 27, 2022.

Assessment

This issue has not been assessed yet.

Description

branch

When I run the following tests

struct custom_char_traits : std::char_traits<char> {};

BOOST_AUTO_TEST_CASE(custom_char_traits_compare)
{
    using sv = std::basic_string_view<char, custom_char_traits>;
    sv sv1 = "sv1";
    sv sv2 = "sv2";
    BOOST_TEST(sv1 == sv2);
}

BOOST_AUTO_TEST_CASE(std_char_traits_compare)
{
    using sv = std::basic_string_view<char, std::char_traits<char>>;
    sv sv1 = "sv1";
    sv sv2 = "sv2";
    BOOST_TEST(sv1 == sv2);
}

I get the following output

*** 2 failures are detected in the test module "string view comparison"
Running 2 test cases...
example.cpp(14): error: in "custom_char_traits_compare": check sv1 == sv2 has failed
example.cpp(22): error: in "std_char_traits_compare": check sv1 == sv2 has failed [sv1 != sv2]

The error message for std_char_traits_compare contains the string values, but the error for custom_char_traits_compare does not.
Boost Test should display the compared strings regardless of what traits they have.

Dominant language
C++
Stars
213
Forks
149
Avg merge
18h 17m
Merged PRs (30d)
2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/test

All issues in boostorg/test

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.