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

-tc does not work with comma in names #398

Closed
martinus opened this issue Jul 19, 2020 · 3 comments
Closed

-tc does not work with comma in names #398

martinus opened this issue Jul 19, 2020 · 3 comments

Comments

@martinus
Copy link
Contributor

A simple reproducer is this:

TEST_CASE("a,b") {}

It doesn't seem to be possible to run this test with -tc. I can run ./app -ltc which prints

a,b

But running ./app -tc='a,b' tries to run test a and test b, which both don't exist.

That's not a big problem in that case because I can just rename the test, but it becomes a problem with TEST_CASE_TEMPLATE. E.g. see this reproducer:

template <typename X, typename Y>
class Foo {};
TYPE_TO_STRING(Foo<int, int>);

TEST_CASE_TEMPLATE("foo", T, Foo<int, int>) {}

Running ./app -ltc prints

foo<Foo<int, int>>

But since the test contains a , it is not possible to run just this test 😢

@onqtam
Copy link
Member

onqtam commented Sep 7, 2020

Sorry for the late reply! This issue is the same for filtering test cases and subcases - the best I could offer for now is to use ? (will match 1 character) instead of the commas (,), so in your case you could use a?b. Maybe I should put this in the FAQ & the relevant places in the docs for now... and also maybe escaping should be possible. Will keep this open until the problem is resolved.

@onqtam
Copy link
Member

onqtam commented Apr 6, 2021

a PR which allows commas to be escaped (with \ as a prefix) was just merged in dev, however, I do think that this solution (as proposed in #135 ):

or change the argument syntax so that if you want to run multiple subcases, you would type --sc='ab' --sc='cd'

would be better in the long term, so I'll keep this issue open

@Saalvage
Copy link
Member

Saalvage commented Mar 5, 2022

Primary issue fixed, #135 will remain as the potential rest of this is figured out.

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

No branches or pull requests

3 participants