示例#1
0
func TestExample(t *testing.T) {
	st.Expect(t, "a", "a")
	st.Reject(t, 42, int64(42))

	st.Assert(t, "t", "t")
	st.Refute(t, 99, int64(99))
}
示例#2
0
func TestTableExample(t *testing.T) {
	examples := []struct{ a, t string }{
		{"first", "first"},
		{"second", "second"},
	}

	// Pass example index to improve the error message for table-based tests.
	for i, ex := range examples {
		st.Expect(t, ex, ex, i)
		st.Reject(t, ex, &ex, i)
	}

	// Cannot pass index into Assert or Refute, they fail fast.
	for _, ex := range examples {
		st.Assert(t, ex, ex)
		st.Refute(t, ex, &ex)
	}
}