Skip to content

Instantly share code, notes, and snippets.

@fredrb
Created November 6, 2022 16:39
Show Gist options
  • Save fredrb/f6d2cf31dfcf1260cc207407bdff377b to your computer and use it in GitHub Desktop.
Save fredrb/f6d2cf31dfcf1260cc207407bdff377b to your computer and use it in GitHub Desktop.
func Test_CheckValuesAreSame(t *testing.T) {
assert.With(t).Equal("a", "b") // assertion fails but tests continue
assert.With(t).Must().Equal("a", "b") // assertion fails and test stops
panic("This panic shouldn't happen")
}
func Test_FormatTesting(t *testing.T) {
assert.With(t).Messagef("%s should be equal %s", "a", "b").
Equal("a", "b")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment