Skip to content

Can Chain assertions#493

Closed
mockersf wants to merge 3 commits into
Quick:masterfrom
mockersf:chain
Closed

Can Chain assertions#493
mockersf wants to merge 3 commits into
Quick:masterfrom
mockersf:chain

Conversation

@mockersf
Copy link
Copy Markdown
Contributor

related to #369
The goal is to be able to chain assertions, for example:

expect(2).toNot(equal(1)).to(equal(2)).notTo(equal(3))
expect(["a", "b"]).to(haveCount(2)).to(contain("a"))
expect { () -> Int in return 5 }.toNot(throwError()).to(equal(5))

("testToNotNegativeMatches", testToNotNegativeMatches),
("testNotToMatchesLikeToNot", testNotToMatchesLikeToNot),
("testChainExpectation", testChainExpectation),
("testChainFailOnFirstError", testChainFailOnFirstError)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Comma Violation: Multi-line collection literals should have trailing commas. (trailing_comma)

func testNotToMatchesLikeToNot() {
expect(1).notTo(MatcherFunc { _, _ in false })
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

expect { throw NimbleError.laugh }.to(throwError(NimbleError.laugh, closure: closure))
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

expect { () -> Void in fatalError() }.toNot(throwAssertion())
}
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trailing Whitespace Violation: Lines should not have trailing whitespace. (trailing_whitespace)

@sunshinejr
Copy link
Copy Markdown
Contributor

This is awesome! Is there a chance that we can get this one updated & reviewed @mockersf @ikesyo?

@ikesyo
Copy link
Copy Markdown
Member

ikesyo commented May 6, 2020

I'm sorry for the late response, this is superseded by #742. Thank you for tackling this @mockersf!

@mockersf
Copy link
Copy Markdown
Contributor Author

thank you for getting it done !

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

Successfully merging this pull request may close these issues.

4 participants