Esempio n. 1
0
func (s *HelpersS) TestCheckEqualArrayFailing(c *gocheck.C) {
	log := "helpers_test.go:[0-9]+ > helpers_test.go:[0-9]+:\n" +
		"\\.+ CheckEqual\\(obtained, expected\\):\n" +
		"\\.+ Obtained \\(\\[\\]uint8\\): \\[\\]byte{0x1, 0x2}\n" +
		"\\.+ Expected \\(\\[\\]uint8\\): \\[\\]byte{0x1, 0x3}\n\n"
	testHelperFailure(c, "CheckEqual([]byte{2}, []byte{3})", false, false, log,
		func() interface{} {
			return c.CheckEqual([]byte{1, 2}, []byte{1, 3})
		})
}
Esempio n. 2
0
func (s *HelpersS) TestCheckEqualFailingWithNil(c *gocheck.C) {
	log := "helpers_test.go:[0-9]+ > helpers_test.go:[0-9]+:\n" +
		"\\.+ CheckEqual\\(obtained, expected\\):\n" +
		"\\.+ Obtained \\(int\\): 10\n" +
		"\\.+ Expected \\(nil\\): nil\n\n"
	testHelperFailure(c, "CheckEqual(10, nil)", false, false, log,
		func() interface{} {
			return c.CheckEqual(10, nil)
		})
}
Esempio n. 3
0
func (s *HelpersS) TestCheckEqualWithBugInfo(c *gocheck.C) {
	log := "helpers_test.go:[0-9]+ > helpers_test.go:[0-9]+:\n" +
		"\\.+ CheckEqual\\(obtained, expected\\):\n" +
		"\\.+ Obtained \\(int\\): 10\n" +
		"\\.+ Expected \\(int\\): 20\n" +
		"\\.+ That's clearly WRONG!\n\n"
	testHelperFailure(c, "CheckEqual(10, 20, issue)", false, false, log,
		func() interface{} {
			return c.CheckEqual(10, 20, "That's clearly ", "WRONG!")
		})
}
Esempio n. 4
0
func (s *HelpersS) TestCheckEqualArraySucceeding(c *gocheck.C) {
	testHelperSuccess(c, "CheckEqual([]byte, []byte)", true, func() interface{} {
		return c.CheckEqual([]byte{1, 2}, []byte{1, 2})
	})
}