Пример #1
0
func Test_getFields_panic(t *testing.T) {
	fn := func() {
		p := make(map[int]string)
		getFields(p)
	}

	assert.Panic(t, fn, "Expected pointer")

	fn = func() {
		p := 1
		getFields(p)
	}

	assert.Panic(t, fn, "Expected pointer")

	fn = func() {
		p := []string{"aaa"}
		getFields(p)
	}

	assert.Panic(t, fn, "Expected pointer")

	fn = func() {
		p := []string{"aaa"}
		getFields(&p)
	}

	assert.Panic(t, fn, "Expected pointer to")

	fn = func() {
		p := new(person)
		getFields(&p)
	}

	assert.Panic(t, fn, "Expected pointer to")
}
Пример #2
0
func Test_InitMySqlAssertions(t *testing.T) {
	fn := func() {
		InitMySqlAssertions(TEST_DB_PROTOCOL, "", TEST_DB_ADDRESS, TEST_DB_USER, "wrong password", TEST_DB_NAME)
	}
	assert.Panic(t, fn)
}