Beispiel #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})
		})
}
Beispiel #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)
		})
}
Beispiel #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!")
		})
}
Beispiel #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})
	})
}