Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hidden tags specified as "[.foo]" aren't matched #1798

Closed
echuber2 opened this issue Nov 4, 2019 · 3 comments
Closed

Hidden tags specified as "[.foo]" aren't matched #1798

echuber2 opened this issue Nov 4, 2019 · 3 comments

Comments

@echuber2
Copy link
Contributor

echuber2 commented Nov 4, 2019

Sorry, I hit "enter" and submitted this one too soon. Edited:

Describe the bug
If you have a test case that had a hidden tag specified as [.foo], in the past, you could specify it on the executable as in:

./program [.foo]

However, now it reports no matching test. Other forms of specifying the tag do work, such as:

./program [.]
./program [foo]

In much older versions, I think the last one here actually hadn't worked, though.

Expected behavior
./program [.foo] should launch the hidden [.foo] (or [.][foo]) test case, as in some previous versions of Catch.

Reproduction steps
Using catch.hpp v2.10.2.
Create foo.cpp:

#define CATCH_CONFIG_MAIN

#include "catch.hpp"

TEST_CASE("Test", "[.foo]") {

  REQUIRE(true);

}

Compiling and testing:

$ g++ --std=c++11 foo.cpp -o foo
$ ls
catch.hpp  foo  foo.cpp
$ ./foo
===============================================================================
No tests ran

$ ./foo [.]
Filters: [.]
===============================================================================
All tests passed (1 assertion in 1 test case)

$ ./foo [foo]
Filters: [foo]
===============================================================================
All tests passed (1 assertion in 1 test case)

$ ./foo [.foo]
Filters: [.foo]
No test cases matched '[.foo]'
===============================================================================
No tests ran

Platform information:

  • OS: Linux
  • Compiler+version: g++ 5.4.0 and/or 7.2, clang 3.8
  • Catch version: v2.10.2

Used to work as expected in Catch version v2.2.3.

@echuber2 echuber2 changed the title Hidden tags specified as "[.foo]" aren Hidden tags specified as "[.foo]" aren't matched Nov 4, 2019
@echuber2
Copy link
Contributor Author

echuber2 commented Nov 4, 2019

(Sorry, I hit "enter" and submitted this one too soon. Edited.)

@horenmar
Copy link
Member

horenmar commented Nov 4, 2019

Right, the problem is that we recently started normalizing [.foo] into [.][foo] as was intended according to the documentation, but which we did not do for a long time. As you noted, this meant that [foo] would not call test cases tagged as [.foo].

I will not revert the changes, but I think we could make the test spec parser also normalize [.foo] into [.][foo]...

@echuber2
Copy link
Contributor Author

echuber2 commented Nov 4, 2019

Thank you. I can adjust to these changes, but I'd previously distributed some scripts to students that tried to invoke it the "[.foo]" way from the shell, which has caused me a problem. It's not disastrous but it may affect some existing system configurations.

horenmar added a commit that referenced this issue Feb 13, 2020
b77cec0 fixed this problem for tagging tests, so that a test
case tagged with `[.foo]` would be parsed as tagged with `[.][foo]`.
This does the same for the test spec parsing.

Fixes #1798
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants