BOOST_TEST_EQ does not print C strings

Open
#91 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
testing-qa

Research direction

Start with the test_output_impl overload in include/boost/core/lightweight_test.hpp at the linked line, then reproduce the failure in libs/filesystem/test/path_test.cpp around line 341. Determine whether C strings should display their contents and whether the behavior should be optional; done means the failing diagnostic is resolved and the relevant test behavior is covered.

Written by the indexing model from the issue text.

Description

BOOST_TEST_EQ that involve C-style strings do not output string contents. For example, BOOST_TEST_EQ(*++itr, "foo"); shows this on failure:

libs\filesystem\test\path_test.cpp(341): test '*++itr == "foo"' ('"c:"' == '00007FF79AE87414') failed in function 'void __cdecl `anonymous-namespace'::iterator_tests(void)'

This seems to be caused by this test_output_impl overload:

https://github.com/boostorg/core/blob/e53393357f32078f55cdb291a536bb567895bc62/include/boost/core/lightweight_test.hpp#L167

Is this intended to return const void* instead of const char*?

If yes, then could we make this behavior optional?

Dominant language
C++
Stars
156
Forks
116
PR merge metrics
No merged PRs in 30d

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/core

All issues in boostorg/core

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.