-
Notifications
You must be signed in to change notification settings - Fork 255
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change most built-in Truth assertions to use the new (package-private…
…) failure API and message format, and update depot tests to expect the new format. The new message format replaces the existing "Not true that..." sentences with multi-line key-value pairs, which we internally call "facts," like: expected: foo but was : bar Note that this reduces the amount of quoting (with "" and <>) that we need to do (though it does obscure changes in trailing whitespace, a problem we should address eventually). It also causes us to throw ComparisonFailure in more cases and to use a different format (sometimes diff-style output) for those new ComparisonFailures. (One note about a very specific change: This lets assertThat(optional).hasValue(value) use Truth's normal equality checking, which treats, e.g., 1 as equal to 1L and `new int[] {0}` as equal to `new int[] {0}`, even though Object.equals() return falses. I don't actually have a strong opinion on which method of equality checking is better overall (though it's certainly better for asserting that an OptionalDouble hasValue(NaN), if possibly inconvenient for asserting that it has value "zero or negative zero"), though. Rather, the purpose of this change is to provide consistent failure messages (including using ComparisonFailure).) This commit exposes an API for testing fact-format messages but does not yet expose the API for producing them. (That API still needs further API Review.) RELNOTES=Changed most of Truth's failure messages to a multi-line, key-value format. Provided an API for testing messages of this format. But did not yet expose the methods for custom subjects to generate messages in this format. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=191106221
- Loading branch information
1 parent
08908c1
commit 4a51035
Showing
66 changed files
with
869 additions
and
1,800 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
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
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.