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

Add BDD AND_GIVEN based macros #1363

Merged
merged 2 commits into from
Sep 2, 2018
Merged

Add BDD AND_GIVEN based macros #1363

merged 2 commits into from
Sep 2, 2018

Conversation

parnmatt
Copy link
Contributor

@parnmatt parnmatt commented Aug 14, 2018

Description

It is possible to have multple given contexts in a single BDD scenario;
if you have to type 'and' in the GIVEN description; it's very likely you
need an AND.

A generic AND is not possible, thus a AND_GIVEN is added to complement
the AND_WHEN and AND_THEN.

Can be used without needing to increase indent:

SCENARIO("...") {
    GIVEN("...")
    AND_GIVEN("...") {
        WHEN("...") {
            THEN("...") {
                // ...
            }
        }
    }
}

would correctly output, when requested/needed:

    Given: ...
And given: ...
     When: ...
     Then: ...

The padding had to be increased by a character in the output message, to
continue to be uniform.

GitHub Issues

Closes #1360

issue #1360

It is possible to have multple  given contexts in a single BDD scenario;
if you have to type 'and' in the GIVEN description; it's very likely you
need an AND.

A generic AND  is not possible, thus a AND_GIVEN  is added to complement
the AND_WHEN and AND_THEN.

Can be used without needing to increase indent:

	SCENARIO("...") {
		GIVEN("...")
		AND_GIVEN("...") {
			WHEN("...") {
				THEN("...") {
					// ...
				}
			}
		}
	}

would correctly output, when requested/needed:

    Given: ...
And given: ...
     When: ...
     Then: ...

The padding had to be increased by a character in the output message, to
continue to be uniform.
@parnmatt
Copy link
Contributor Author

The differences in expected output are due to the extra space for padding (to keep consistency)

@horenmar
Copy link
Member

horenmar commented Sep 2, 2018

I like this, just gonna fix up the commit first.

@horenmar horenmar added the Tweak label Sep 2, 2018
@codecov
Copy link

codecov bot commented Sep 2, 2018

Codecov Report

Merging #1363 into master will increase coverage by 0.3%.
The diff coverage is n/a.

@@            Coverage Diff            @@
##           master    #1363     +/-   ##
=========================================
+ Coverage   79.78%   80.08%   +0.3%     
=========================================
  Files         113      118      +5     
  Lines        3279     3378     +99     
=========================================
+ Hits         2616     2705     +89     
- Misses        663      673     +10

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

Successfully merging this pull request may close these issues.

2 participants