Skip to content

Conversation

@mockersf
Copy link
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)

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 })
}

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))
}
}

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())
}
}

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
Contributor

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

@ikesyo
Copy link
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
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