Skip to content

Commit

Permalink
Remove redundant section information in TeamCity reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
cschreib committed Sep 27, 2024
1 parent d76f2d1 commit 4e80bf5
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 52 deletions.
5 changes: 1 addition & 4 deletions src/snitch_reporter_teamcity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,8 @@ void print_assertion(const registry& r, const assertion& msg) noexcept {
small_string<max_message_length> buffer;

r.print("'", make_escaped(buffer, msg.location.file), ":", msg.location.line, "|n");
for (const auto& s : msg.sections) {
r.print(make_escaped(buffer, s.id.name), "|n");
}
for (const auto& c : msg.captures) {
r.print(make_escaped(buffer, c), "|n");
r.print("with ", make_escaped(buffer, c), "|n");
}

constexpr std::string_view indent = " ";
Expand Down
4 changes: 2 additions & 2 deletions tests/approval_tests/data/expected/reporter_teamcity_allfail
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
##teamCity[testStarted name='test unexpected throw in section fail']
##teamCity[blockOpened name='section 1' description='']
##teamCity[blockOpened name='section 2' description='']
##teamCity[testFailed name='test unexpected throw in section fail' message='*testing_reporters.cpp:*|nsection 1|nsection 2|n unexpected std::exception caught; message: unexpected error']
##teamCity[testFailed name='test unexpected throw in section fail' message='*testing_reporters.cpp:*|n unexpected std::exception caught; message: unexpected error']
##teamCity[blockClosed name='section 2']
##teamCity[blockClosed name='section 1']
##teamCity[testFinished name='test unexpected throw in section fail' duration='*']
Expand All @@ -61,7 +61,7 @@
##teamCity[testFinished name='test unexpected throw in check fail' duration='*']
##teamCity[testStarted name='test unexpected throw in check & section fail']
##teamCity[blockOpened name='section 1' description='']
##teamCity[testFailed name='test unexpected throw in check & section fail' message='*testing_reporters.cpp:*|nsection 1|n unexpected std::exception caught; message: unexpected error']
##teamCity[testFailed name='test unexpected throw in check & section fail' message='*testing_reporters.cpp:*|n unexpected std::exception caught; message: unexpected error']
##teamCity[blockClosed name='section 1']
##teamCity[testFinished name='test unexpected throw in check & section fail' duration='*']
##teamCity[testSuiteFinished name='test "* fail*"']
46 changes: 23 additions & 23 deletions tests/approval_tests/data/expected/reporter_teamcity_default
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
##teamCity[testStarted name='test unexpected throw in section fail']
##teamCity[blockOpened name='section 1' description='']
##teamCity[blockOpened name='section 2' description='']
##teamCity[testFailed name='test unexpected throw in section fail' message='*testing_reporters.cpp:*|nsection 1|nsection 2|n unexpected std::exception caught; message: unexpected error']
##teamCity[testFailed name='test unexpected throw in section fail' message='*testing_reporters.cpp:*|n unexpected std::exception caught; message: unexpected error']
##teamCity[blockClosed name='section 2']
##teamCity[blockClosed name='section 1']
##teamCity[testFinished name='test unexpected throw in section fail' duration='*']
Expand All @@ -98,72 +98,72 @@
##teamCity[testFinished name='test unexpected throw in check fail' duration='*']
##teamCity[testStarted name='test unexpected throw in check & section fail']
##teamCity[blockOpened name='section 1' description='']
##teamCity[testFailed name='test unexpected throw in check & section fail' message='*testing_reporters.cpp:*|nsection 1|n unexpected std::exception caught; message: unexpected error']
##teamCity[testFailed name='test unexpected throw in check & section fail' message='*testing_reporters.cpp:*|n unexpected std::exception caught; message: unexpected error']
##teamCity[blockClosed name='section 1']
##teamCity[testFinished name='test unexpected throw in check & section fail' duration='*']
##teamCity[testStarted name='test SKIP']
##teamCity[testIgnored name='test SKIP' message='*testing_reporters.cpp:*|n not interesting']
##teamCity[testFinished name='test SKIP' duration='*']
##teamCity[testStarted name='test INFO']
##teamCity[testFailed name='test INFO' message='*testing_reporters.cpp:*|ninfo|n failure']
##teamCity[testFailed name='test INFO' message='*testing_reporters.cpp:*|nwith info|n failure']
##teamCity[testFinished name='test INFO' duration='*']
##teamCity[testStarted name='test multiple INFO']
##teamCity[testFailed name='test multiple INFO' message='*testing_reporters.cpp:*|n failure 1']
##teamCity[testFailed name='test multiple INFO' message='*testing_reporters.cpp:*|ninfo 1|n failure 2']
##teamCity[testFailed name='test multiple INFO' message='*testing_reporters.cpp:*|ninfo 1|ninfo 2|n failure 3']
##teamCity[testFailed name='test multiple INFO' message='*testing_reporters.cpp:*|ninfo 1|n failure 4']
##teamCity[testFailed name='test multiple INFO' message='*testing_reporters.cpp:*|nwith info 1|n failure 2']
##teamCity[testFailed name='test multiple INFO' message='*testing_reporters.cpp:*|nwith info 1|nwith info 2|n failure 3']
##teamCity[testFailed name='test multiple INFO' message='*testing_reporters.cpp:*|nwith info 1|n failure 4']
##teamCity[testFinished name='test multiple INFO' duration='*']
##teamCity[testStarted name='test SECTION']
##teamCity[blockOpened name='section' description='']
##teamCity[testFailed name='test SECTION' message='*testing_reporters.cpp:*|nsection|n failure']
##teamCity[testFailed name='test SECTION' message='*testing_reporters.cpp:*|n failure']
##teamCity[blockClosed name='section']
##teamCity[testFinished name='test SECTION' duration='*']
##teamCity[testStarted name='test multiple SECTION']
##teamCity[blockOpened name='section 1' description='']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|nsection 1|n failure 1']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|n failure 1']
##teamCity[blockClosed name='section 1']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|n failure 7']
##teamCity[blockOpened name='section 2' description='']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|nsection 2|n failure 2']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|n failure 2']
##teamCity[blockOpened name='section 2.1' description='']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|nsection 2|nsection 2.1|n failure 3']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|n failure 3']
##teamCity[blockClosed name='section 2.1']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|n failure 7']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|nsection 2|n failure 2']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|n failure 2']
##teamCity[blockOpened name='section 2.2' description='']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|nsection 2|nsection 2.2|n failure 4']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|n failure 4']
##teamCity[blockOpened name='section 2.2.1' description='']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|nsection 2|nsection 2.2|nsection 2.2.1|n failure 5']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|n failure 5']
##teamCity[blockClosed name='section 2.2.1']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|nsection 2|nsection 2.2|n failure 6']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|n failure 6']
##teamCity[blockClosed name='section 2.2']
##teamCity[blockClosed name='section 2']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|n failure 7']
##teamCity[testFinished name='test multiple SECTION' duration='*']
##teamCity[testStarted name='test SECTION & INFO']
##teamCity[blockOpened name='section 1' description='']
##teamCity[testFailed name='test SECTION & INFO' message='*testing_reporters.cpp:*|nsection 1|ninfo 1|ninfo 2|n failure 1']
##teamCity[testFailed name='test SECTION & INFO' message='*testing_reporters.cpp:*|nwith info 1|nwith info 2|n failure 1']
##teamCity[blockClosed name='section 1']
##teamCity[testFailed name='test SECTION & INFO' message='*testing_reporters.cpp:*|ninfo 1|n failure 3']
##teamCity[testFailed name='test SECTION & INFO' message='*testing_reporters.cpp:*|nwith info 1|n failure 3']
##teamCity[blockOpened name='section 2' description='']
##teamCity[testFailed name='test SECTION & INFO' message='*testing_reporters.cpp:*|nsection 2|ninfo 1|ninfo 3|n failure 2']
##teamCity[testFailed name='test SECTION & INFO' message='*testing_reporters.cpp:*|nwith info 1|nwith info 3|n failure 2']
##teamCity[blockClosed name='section 2']
##teamCity[testFailed name='test SECTION & INFO' message='*testing_reporters.cpp:*|ninfo 1|n failure 3']
##teamCity[testFailed name='test SECTION & INFO' message='*testing_reporters.cpp:*|nwith info 1|n failure 3']
##teamCity[testFinished name='test SECTION & INFO' duration='*']
##teamCity[testStarted name='test SECTION & CAPTURE']
##teamCity[blockOpened name='section 1' description='']
##teamCity[testFailed name='test SECTION & CAPTURE' message='*testing_reporters.cpp:*|nsection 1|ni := 1|nj := 2|n failure 1']
##teamCity[testFailed name='test SECTION & CAPTURE' message='*testing_reporters.cpp:*|nwith i := 1|nwith j := 2|n failure 1']
##teamCity[blockClosed name='section 1']
##teamCity[testFailed name='test SECTION & CAPTURE' message='*testing_reporters.cpp:*|ni := 1|n failure 3']
##teamCity[testFailed name='test SECTION & CAPTURE' message='*testing_reporters.cpp:*|nwith i := 1|n failure 3']
##teamCity[blockOpened name='section 2' description='']
##teamCity[testFailed name='test SECTION & CAPTURE' message='*testing_reporters.cpp:*|nsection 2|ni := 1|nj := 3|n failure 2']
##teamCity[testFailed name='test SECTION & CAPTURE' message='*testing_reporters.cpp:*|nwith i := 1|nwith j := 3|n failure 2']
##teamCity[blockClosed name='section 2']
##teamCity[testFailed name='test SECTION & CAPTURE' message='*testing_reporters.cpp:*|ni := 1|n failure 3']
##teamCity[testFailed name='test SECTION & CAPTURE' message='*testing_reporters.cpp:*|nwith i := 1|n failure 3']
##teamCity[testFinished name='test SECTION & CAPTURE' duration='*']
##teamCity[testStarted name='test SKIP in SECTION']
##teamCity[blockOpened name='section 1' description='']
##teamCity[blockOpened name='section 2' description='']
##teamCity[testIgnored name='test SKIP in SECTION' message='*testing_reporters.cpp:*|nsection 1|nsection 2|n stopping here']
##teamCity[testIgnored name='test SKIP in SECTION' message='*testing_reporters.cpp:*|n stopping here']
##teamCity[blockClosed name='section 2']
##teamCity[blockClosed name='section 1']
##teamCity[testFinished name='test SKIP in SECTION' duration='*']
Expand Down
46 changes: 23 additions & 23 deletions tests/approval_tests/data/expected/reporter_teamcity_full
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
##teamCity[testStarted name='test unexpected throw in section fail']
##teamCity[blockOpened name='section 1' description='']
##teamCity[blockOpened name='section 2' description='']
##teamCity[testFailed name='test unexpected throw in section fail' message='*testing_reporters.cpp:*|nsection 1|nsection 2|n unexpected std::exception caught; message: unexpected error']
##teamCity[testFailed name='test unexpected throw in section fail' message='*testing_reporters.cpp:*|n unexpected std::exception caught; message: unexpected error']
##teamCity[blockClosed name='section 2']
##teamCity[blockClosed name='section 1']
##teamCity[testFinished name='test unexpected throw in section fail' duration='*']
Expand All @@ -135,78 +135,78 @@
##teamCity[testFinished name='test unexpected throw in check fail' duration='*']
##teamCity[testStarted name='test unexpected throw in check & section fail']
##teamCity[blockOpened name='section 1' description='']
##teamCity[testFailed name='test unexpected throw in check & section fail' message='*testing_reporters.cpp:*|nsection 1|n unexpected std::exception caught; message: unexpected error']
##teamCity[testFailed name='test unexpected throw in check & section fail' message='*testing_reporters.cpp:*|n unexpected std::exception caught; message: unexpected error']
##teamCity[blockClosed name='section 1']
##teamCity[testFinished name='test unexpected throw in check & section fail' duration='*']
##teamCity[testStarted name='test SKIP']
##teamCity[testIgnored name='test SKIP' message='*testing_reporters.cpp:*|n not interesting']
##teamCity[testFinished name='test SKIP' duration='*']
##teamCity[testStarted name='test INFO']
##teamCity[testFailed name='test INFO' message='*testing_reporters.cpp:*|ninfo|n failure']
##teamCity[testFailed name='test INFO' message='*testing_reporters.cpp:*|nwith info|n failure']
##teamCity[testStdOut name='test INFO' out='*testing_reporters.cpp:*|n no exception caught']
##teamCity[testFinished name='test INFO' duration='*']
##teamCity[testStarted name='test multiple INFO']
##teamCity[testFailed name='test multiple INFO' message='*testing_reporters.cpp:*|n failure 1']
##teamCity[testFailed name='test multiple INFO' message='*testing_reporters.cpp:*|ninfo 1|n failure 2']
##teamCity[testFailed name='test multiple INFO' message='*testing_reporters.cpp:*|ninfo 1|ninfo 2|n failure 3']
##teamCity[testFailed name='test multiple INFO' message='*testing_reporters.cpp:*|ninfo 1|n failure 4']
##teamCity[testFailed name='test multiple INFO' message='*testing_reporters.cpp:*|nwith info 1|n failure 2']
##teamCity[testFailed name='test multiple INFO' message='*testing_reporters.cpp:*|nwith info 1|nwith info 2|n failure 3']
##teamCity[testFailed name='test multiple INFO' message='*testing_reporters.cpp:*|nwith info 1|n failure 4']
##teamCity[testStdOut name='test multiple INFO' out='*testing_reporters.cpp:*|n no exception caught']
##teamCity[testFinished name='test multiple INFO' duration='*']
##teamCity[testStarted name='test SECTION']
##teamCity[blockOpened name='section' description='']
##teamCity[testFailed name='test SECTION' message='*testing_reporters.cpp:*|nsection|n failure']
##teamCity[testFailed name='test SECTION' message='*testing_reporters.cpp:*|n failure']
##teamCity[blockClosed name='section']
##teamCity[testStdOut name='test SECTION' out='*testing_reporters.cpp:*|n no exception caught']
##teamCity[testFinished name='test SECTION' duration='*']
##teamCity[testStarted name='test multiple SECTION']
##teamCity[blockOpened name='section 1' description='']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|nsection 1|n failure 1']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|n failure 1']
##teamCity[blockClosed name='section 1']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|n failure 7']
##teamCity[blockOpened name='section 2' description='']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|nsection 2|n failure 2']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|n failure 2']
##teamCity[blockOpened name='section 2.1' description='']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|nsection 2|nsection 2.1|n failure 3']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|n failure 3']
##teamCity[blockClosed name='section 2.1']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|n failure 7']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|nsection 2|n failure 2']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|n failure 2']
##teamCity[blockOpened name='section 2.2' description='']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|nsection 2|nsection 2.2|n failure 4']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|n failure 4']
##teamCity[blockOpened name='section 2.2.1' description='']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|nsection 2|nsection 2.2|nsection 2.2.1|n failure 5']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|n failure 5']
##teamCity[blockClosed name='section 2.2.1']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|nsection 2|nsection 2.2|n failure 6']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|n failure 6']
##teamCity[blockClosed name='section 2.2']
##teamCity[blockClosed name='section 2']
##teamCity[testFailed name='test multiple SECTION' message='*testing_reporters.cpp:*|n failure 7']
##teamCity[testStdOut name='test multiple SECTION' out='*testing_reporters.cpp:*|n no exception caught']
##teamCity[testFinished name='test multiple SECTION' duration='*']
##teamCity[testStarted name='test SECTION & INFO']
##teamCity[blockOpened name='section 1' description='']
##teamCity[testFailed name='test SECTION & INFO' message='*testing_reporters.cpp:*|nsection 1|ninfo 1|ninfo 2|n failure 1']
##teamCity[testFailed name='test SECTION & INFO' message='*testing_reporters.cpp:*|nwith info 1|nwith info 2|n failure 1']
##teamCity[blockClosed name='section 1']
##teamCity[testFailed name='test SECTION & INFO' message='*testing_reporters.cpp:*|ninfo 1|n failure 3']
##teamCity[testFailed name='test SECTION & INFO' message='*testing_reporters.cpp:*|nwith info 1|n failure 3']
##teamCity[blockOpened name='section 2' description='']
##teamCity[testFailed name='test SECTION & INFO' message='*testing_reporters.cpp:*|nsection 2|ninfo 1|ninfo 3|n failure 2']
##teamCity[testFailed name='test SECTION & INFO' message='*testing_reporters.cpp:*|nwith info 1|nwith info 3|n failure 2']
##teamCity[blockClosed name='section 2']
##teamCity[testFailed name='test SECTION & INFO' message='*testing_reporters.cpp:*|ninfo 1|n failure 3']
##teamCity[testFailed name='test SECTION & INFO' message='*testing_reporters.cpp:*|nwith info 1|n failure 3']
##teamCity[testStdOut name='test SECTION & INFO' out='*testing_reporters.cpp:*|n no exception caught']
##teamCity[testFinished name='test SECTION & INFO' duration='*']
##teamCity[testStarted name='test SECTION & CAPTURE']
##teamCity[blockOpened name='section 1' description='']
##teamCity[testFailed name='test SECTION & CAPTURE' message='*testing_reporters.cpp:*|nsection 1|ni := 1|nj := 2|n failure 1']
##teamCity[testFailed name='test SECTION & CAPTURE' message='*testing_reporters.cpp:*|nwith i := 1|nwith j := 2|n failure 1']
##teamCity[blockClosed name='section 1']
##teamCity[testFailed name='test SECTION & CAPTURE' message='*testing_reporters.cpp:*|ni := 1|n failure 3']
##teamCity[testFailed name='test SECTION & CAPTURE' message='*testing_reporters.cpp:*|nwith i := 1|n failure 3']
##teamCity[blockOpened name='section 2' description='']
##teamCity[testFailed name='test SECTION & CAPTURE' message='*testing_reporters.cpp:*|nsection 2|ni := 1|nj := 3|n failure 2']
##teamCity[testFailed name='test SECTION & CAPTURE' message='*testing_reporters.cpp:*|nwith i := 1|nwith j := 3|n failure 2']
##teamCity[blockClosed name='section 2']
##teamCity[testFailed name='test SECTION & CAPTURE' message='*testing_reporters.cpp:*|ni := 1|n failure 3']
##teamCity[testFailed name='test SECTION & CAPTURE' message='*testing_reporters.cpp:*|nwith i := 1|n failure 3']
##teamCity[testStdOut name='test SECTION & CAPTURE' out='*testing_reporters.cpp:*|n no exception caught']
##teamCity[testFinished name='test SECTION & CAPTURE' duration='*']
##teamCity[testStarted name='test SKIP in SECTION']
##teamCity[blockOpened name='section 1' description='']
##teamCity[blockOpened name='section 2' description='']
##teamCity[testIgnored name='test SKIP in SECTION' message='*testing_reporters.cpp:*|nsection 1|nsection 2|n stopping here']
##teamCity[testIgnored name='test SKIP in SECTION' message='*testing_reporters.cpp:*|n stopping here']
##teamCity[blockClosed name='section 2']
##teamCity[blockClosed name='section 1']
##teamCity[testFinished name='test SKIP in SECTION' duration='*']
Expand Down

0 comments on commit 4e80bf5

Please sign in to comment.