From 50e725db5c292579f125445c939516469e2747fe Mon Sep 17 00:00:00 2001 From: Bert Wesarg Date: Thu, 14 Apr 2022 08:20:22 +0200 Subject: [PATCH] Indent section names Closes #1556 --- include/reporters/catch_reporter_console.cpp | 4 ++-- projects/SelfTest/Baselines/console.std.approved.txt | 8 ++++---- projects/SelfTest/Baselines/console.sw.approved.txt | 8 ++++---- single_include/catch2/catch.hpp | 4 ++-- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/include/reporters/catch_reporter_console.cpp b/include/reporters/catch_reporter_console.cpp index 4f74ccb320..61ef43d8a5 100644 --- a/include/reporters/catch_reporter_console.cpp +++ b/include/reporters/catch_reporter_console.cpp @@ -547,8 +547,8 @@ void ConsoleReporter::printTestCaseAndSectionHeader() { auto it = m_sectionStack.begin() + 1, // Skip first section (test case) itEnd = m_sectionStack.end(); - for (; it != itEnd; ++it) - printHeaderString(it->name, 2); + for (size_t indent = 2; it != itEnd; ++it, indent += 2) + printHeaderString(it->name, indent); } SourceLineInfo lineInfo = m_sectionStack.back().lineInfo; diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index c29715f044..28bb425405 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -697,7 +697,7 @@ with expansion: ------------------------------------------------------------------------------- Mayfail test case with nested sections A - 1 + 1 ------------------------------------------------------------------------------- Condition.tests.cpp: ............................................................................... @@ -707,7 +707,7 @@ Condition.tests.cpp:: FAILED: ------------------------------------------------------------------------------- Mayfail test case with nested sections A - 2 + 2 ------------------------------------------------------------------------------- Condition.tests.cpp: ............................................................................... @@ -717,7 +717,7 @@ Condition.tests.cpp:: FAILED: ------------------------------------------------------------------------------- Mayfail test case with nested sections B - 1 + 1 ------------------------------------------------------------------------------- Condition.tests.cpp: ............................................................................... @@ -727,7 +727,7 @@ Condition.tests.cpp:: FAILED: ------------------------------------------------------------------------------- Mayfail test case with nested sections B - 2 + 2 ------------------------------------------------------------------------------- Condition.tests.cpp: ............................................................................... diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index 2318ebeaa9..724095e697 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -6498,7 +6498,7 @@ with expansion: ------------------------------------------------------------------------------- Mayfail test case with nested sections A - 1 + 1 ------------------------------------------------------------------------------- Condition.tests.cpp: ............................................................................... @@ -6508,7 +6508,7 @@ Condition.tests.cpp:: FAILED: ------------------------------------------------------------------------------- Mayfail test case with nested sections A - 2 + 2 ------------------------------------------------------------------------------- Condition.tests.cpp: ............................................................................... @@ -6518,7 +6518,7 @@ Condition.tests.cpp:: FAILED: ------------------------------------------------------------------------------- Mayfail test case with nested sections B - 1 + 1 ------------------------------------------------------------------------------- Condition.tests.cpp: ............................................................................... @@ -6528,7 +6528,7 @@ Condition.tests.cpp:: FAILED: ------------------------------------------------------------------------------- Mayfail test case with nested sections B - 2 + 2 ------------------------------------------------------------------------------- Condition.tests.cpp: ............................................................................... diff --git a/single_include/catch2/catch.hpp b/single_include/catch2/catch.hpp index d2a12427b2..01ff59699a 100644 --- a/single_include/catch2/catch.hpp +++ b/single_include/catch2/catch.hpp @@ -16647,8 +16647,8 @@ void ConsoleReporter::printTestCaseAndSectionHeader() { auto it = m_sectionStack.begin() + 1, // Skip first section (test case) itEnd = m_sectionStack.end(); - for (; it != itEnd; ++it) - printHeaderString(it->name, 2); + for (size_t indent = 2; it != itEnd; ++it, indent += 2) + printHeaderString(it->name, indent); } SourceLineInfo lineInfo = m_sectionStack.back().lineInfo;