catchorg / catchorg/Catch2

CATCH_CONFIG_CONSOLE_WIDTH ignored for reconstructing expressions

Open
#1,775 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

**Describe the bug**
When the length of stringified lhs and rhs of an expression is more than 40 characters it gets split due to https://github.com/catchorg/Catch2/blob/9fb38fcc1413103d03c72b6a281351ba2a57b2be/include/internal/catch_decomposer.cpp#L17 This makes the output harder to parse automatically, leading to https://github.com/JohnnyHendriks/TestAdapter_Catch2/issues/32.

**Expected behavior**
Split according to CATCH_CONFIG_CONSOLE_WIDTH instead of 40.

**Reproduction steps**
Code:
```
TEST_CASE( "BreakingLine" )
{
CHECK( 100000000000 == 9999999 );
}
```
Produces:
```
xxx.cpp(yy): FAILED:
CHECK( 100000000000 == 9999999 )
with expansion:
100000000000 (0x174876e800)
==
9999999 (0x98967f)
```
But with CATCH_CONFIG_CONSOLE_WIDTH set to 200 the expected output would be:
```
xxx.cpp(yy): FAILED:
CHECK( 100000000000 == 9999999 )
with expansion:
100000000000 (0x174876e800) == 9999999 (0x98967f)
```

**Platform information:**
- Catch version: **v2.1.0**

**Additional context**
Replacing `40` with e.g. `(CATCH_CONFIG_CONSOLE_WIDTH - 2 - )` is a potential fix.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.