Exemple #1
0
// NotError asserts err is not MySql error.
// Applicable only to github.com/ziutek/mymysql/mysql package.
func NotError(t assert.Tester, err error, args ...interface{}) {
	nesting, failFast, errorMsg := assert.DecodeArgs(args...)
	fn := func() {
		t.Errorf("Did not expect MySQL error: %s", err.Error())
		if len(errorMsg) > 0 {
			t.Error("!", " -", errorMsg)
		}
	}
	_, ok := err.(*mysql.Error)
	assert.Assert(t, !ok, nesting, failFast, fn)
}
Exemple #2
0
// Error asserts err is MySql error.
// Applicable only to github.com/ziutek/mymysql/mysql package.
func Error(t assert.Tester, err error, args ...interface{}) {
	nesting, failFast, errorMsg := assert.DecodeArgs(args...)
	fn := func() {
		t.Error("Expected MySQL error.")
		if len(errorMsg) > 0 {
			t.Error("!", " -", errorMsg)
		}
	}
	_, ok := err.(*mysql.Error)
	assert.Assert(t, ok, nesting+1, failFast, fn)
}