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

Running a specific BDD-style section does not work #1708

Closed
mimon opened this issue Jul 30, 2019 · 3 comments

Comments

@mimon
Copy link

commented Jul 30, 2019

Describe the bug
Given the following example:

SCENARIO("pizza") {
  GIVEN("dough") {
    WHEN("applying") {
      THEN("cheese") {
        CHECK(false);
      }
    }
  }
}

Then running a specific section name $ test *pizza* -c "dough" does not run any assertions on my machine (when it should):

Filters: *pizza*
===============================================================================
test cases: 1 | 1 passed
assertions: - none -

Expected behavior
The assertion should be executed and output something like:

Filters: *pizza*

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tests is a Catch v2.9.1 host application.
Run with -? for options

-------------------------------------------------------------------------------
Scenario: pizza
      Given: dough
       When: applying
       Then: cheese
-------------------------------------------------------------------------------
test.cpp:6
...............................................................................

test.cpp:7: FAILED:
  CHECK( false )

===============================================================================
test cases: 1 | 1 failed
assertions: 1 | 1 failed

Platform information:

  • OS: macOs Sierra
  • Compiler+version: Apple LLVM version 9.0.0 (clang-900.0.38)
    Target: x86_64-apple-darwin16.7.0
    Thread model: posix
  • Catch version: v2.9.1

@mimon mimon changed the title Running a specific BDD-style section Running a specific BDD-style section does not work Jul 30, 2019

@horenmar

This comment has been minimized.

Copy link
Member

commented Jul 30, 2019

The problem here is that due to an implementation detail, the spaces before "given" are part of the section name when you need to filter. This is already being worked upon in the FilterWS branch, for now you can work around it by providing the name like this:

$ ./a.out *pizza* -c "    Given: dough"
Filters: *pizza*

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.out is a Catch v2.9.1 host application.
Run with -? for options

-------------------------------------------------------------------------------
Scenario: pizza
      Given: dough
       When: applying
       Then: cheese
-------------------------------------------------------------------------------
1708.cpp:7
...............................................................................

1708.cpp:8: FAILED:
  CHECK( false )

===============================================================================
test cases: 1 | 1 failed
assertions: 1 | 1 failed
@mimon

This comment has been minimized.

Copy link
Author

commented Jul 30, 2019

Okey. Got it. It works when adding the spaces and the prefix. Thanks.

@mimon mimon closed this Jul 30, 2019

@horenmar

This comment has been minimized.

Copy link
Member

commented Jul 31, 2019

I'll keep this open until we merge the fix into master.

@horenmar horenmar reopened this Jul 31, 2019

@horenmar horenmar closed this in af8b253 Sep 9, 2019

@horenmar horenmar removed the In progress label Sep 9, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.