catchorg / catchorg/Catch2

CATCH_CONFIG_CONSOLE_WIDTH only partially effective

Open
#1,339 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
21.5k
Forks
3.5k
Avg merge
3d 16h
Merged PRs (30d)
2

Description

## Description
Setting CATCH_CONFIG_CONSOLE_WIDTH to a smaller value shows that the value is honored only in some parts of the output.

### Steps to reproduce
Compile this simple test case with `-DCATCH_CONFIG_CONSOLE_WIDTH=20`:

```
#define CATCH_CONFIG_MAIN
#include "catch.hpp"

TEST_CASE( "o_hello_really_long_string_over_20_chars" ) {
REQUIRE( "Hello Catch!" == "Hello, Catch2!");
}
```

The output looks like this:
```
~~~~~~~~~~~~~~~~~~~
tests.exe is a Catch v2.2.3 host application.
Run with -? for options

-------------------
o_hello_really_lon-
g_string_over_20_c-
hars
-------------------
C:\Users\marn\Documents\GitHub\hello_cmake\test\testmain.cpp(8)
...................

C:\Users\marn\Documents\GitHub\hello_cmake\test\testmain.cpp(9): FAILED:
REQUIRE( "Hello Catch!" == "Hello, Catch2!" )

===================
test cases: 1 | 1 failed
assertions: 1 | 1 failed
```

Except for the test case name and the separator lines, every non-empty line is longer than the configured width of 20.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the example with CATCH_CONFIG_CONSOLE_WIDTH set to 20 and trace where the test-case name, separator lines, failure location, assertion, and summary are formatted. Compare each output path against the configured width, then add or update focused tests showing that every non-empty output line respects the setting.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.