Last active
November 27, 2018 08:13
-
-
Save jehaby/0a58675a657cebda8d4c7b2bab9a8e11 to your computer and use it in GitHub Desktop.
testify Contains
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
package main | |
import ( | |
"testing" | |
"github.com/stretchr/testify/require" | |
) | |
type eee struct{} | |
func (eee) Error() string { return "hohoho" } | |
func TestOne(t *testing.T) { | |
e := eee{} | |
require.Contains(t, e, "ho") | |
} | |
func TestTwo(t *testing.T) { | |
e := eee{} | |
require.Contains(t, e, "ha") | |
} | |
func TestThree(t *testing.T) { | |
e := eee{} | |
require.Contains(t, e.Error(), "ho") | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
output: