Catch2 icon indicating copy to clipboard operation
Catch2 copied to clipboard

Empty tag in test case produces crash when generating junit report

Open thorsten-ottosen opened this issue 3 years ago • 3 comments

Describe the bug

If I write a test case like so:

TEST_CASE("Test requirements of some type", "[][type]") {...}

where we have an empty tag "[]", the program crashes when we try to generate junit output. Normal xml output works apparently.

Expected behavior I would expect no crash and that the empty tag is in the output like it is for the normal xml.

Reproduction steps

Build your test executable in debug mode and run

Test.exe -r junit

This should trigger an assertion in std::string about calling front() on an empty string.

Platform information:

  • OS: windows 10
  • Compiler+version: Microsoft (R) C/C++ Optimizing Compiler Version 19.30.30709 for x64
  • Catch version: v2.13.8

thorsten-ottosen avatar Feb 17 '22 10:02 thorsten-ottosen

I am not convinced that empty tags are useful, but they shouldn't cause crashes (I think they should be rejected).

horenmar avatar Feb 20 '22 11:02 horenmar

I can't reproduce this with current devel branch.

TEST_CASE( "Empty tag", "[][type]" ) { REQUIRE( true ); }

$ ./tests/SelfTest
Errors occurred during startup!
  Empty tags are not allowed

However I am unhappy about the behaviour of ./tests/SelfTest [] if I delete the test, as it runs all the tests -- I believe it should be a cli input error and not match every test.

horenmar avatar Feb 20 '22 20:02 horenmar

You are right that it is of no use. I would be happy that it was rejected as invalid.

thorsten-ottosen avatar Feb 20 '22 20:02 thorsten-ottosen