-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: refactor fluent API & source printing for better readability (
#22) This change refactors the fluent API of the package to make the test source code flow better in terms of readability. For example, instead of: ```go With(t).Verify(1).Will(EqualTo(2)).OrFail() ``` The API is now either: ```go With(t).EnsureThat("1 equals 2").ByVerifying(1).Will(EqualTo(2)).Now() With(t).VerifyThat(1).Will(EqualTo(2)).Now() ``` The call to "EnsureThat" is optional and is meant to help documenting the test in case of failures. The change from ".OrFail()" to ".Now()" ensures that every assertion ends with a timing specification: ```go With(t).VerifyThat(1).Will(EqualTo(2)).Now() With(t).VerifyThat(1).Will(EqualTo(2)).For(...) With(t).VerifyThat(1).Will(EqualTo(2))Within(...) ``` Additionally, this refactor improves the printing of the assertion's source code location, enabling support for multi-line location source code. For instance, for the following assertion: ```go With(t). EnsureThat("..."). ByVerifying(1). Will(EqualTo(2)). Now() ``` Previous versions only printed the line containing the "Now()" call, but this version will print the entire statement (from the "With(t)" up to and including the call to "Now()".)
- Loading branch information
Showing
17 changed files
with
197 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.