]> git.ipfire.org Git - thirdparty/git.git/commit
tests: refactor --write-junit-xml code
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Sat, 21 May 2022 22:18:46 +0000 (22:18 +0000)
committerJunio C Hamano <gitster@pobox.com>
Sat, 21 May 2022 23:25:55 +0000 (16:25 -0700)
commit78d5e4cfb4b9f023549596c0d6fd0afdef57d571
tree65f6ab49a11874d36a4c476c1fdaa177daa46277
parent863d6ceb52d10a41b06dc3ad58fc967fc295d9b7
tests: refactor --write-junit-xml code

The code writing JUnit XML is interspersed directly with all the code in
`t/test-lib.sh`, and it is therefore not only ill-separated, but
introducing yet another output format would make the situation even
worse.

Let's introduce an abstraction layer by hiding the JUnit XML code behind
four new functions that are supposed to be called before and after each
test and test case.

This is not just an academic exercise, refactoring for refactoring's
sake. We _actually_ want to introduce such a new output format, to
make it substantially easier to diagnose test failures in our GitHub
workflow, therefore we do need this refactoring.

This commit is best viewed with `git show --color-moved
--color-moved-ws=allow-indentation-change <commit>`.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/test-lib-junit.sh [new file with mode: 0644]
t/test-lib.sh