Skip to content

Commit

Permalink
tests: re-enable integration test suite
Browse files Browse the repository at this point in the history
  • Loading branch information
jhenstridge committed Jun 8, 2024
1 parent 36d16ed commit ec280f8
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 58 deletions.
2 changes: 1 addition & 1 deletion check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
// We count the number of suites run at least to get a vague hint that the
// test suite is behaving as it should. Otherwise a bug introduced at the
// very core of the system could go unperceived.
const suitesRunExpected = 4
const suitesRunExpected = 5

var suitesRun int = 0

Expand Down
104 changes: 47 additions & 57 deletions integration_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//+build nowhere

// Integration tests

package check_test
Expand Down Expand Up @@ -37,60 +35,52 @@ func (s *integrationTestHelper) TestStructEqualFails(c *C) {
c.Check(complexStruct{1, 2}, Equals, complexStruct{3, 4})
}

func (s *integrationS) TestOutput(c *C) {
helper := integrationTestHelper{}
output := String{}
Run(&helper, &RunConf{Output: &output})
c.Assert(output.value, Equals, `
----------------------------------------------------------------------
FAIL: integration_test.go:26: integrationTestHelper.TestIntEqualFails
integration_test.go:27:
c.Check(42, Equals, 43)
... obtained int = 42
... expected int = 43
----------------------------------------------------------------------
FAIL: integration_test.go:18: integrationTestHelper.TestMultiLineStringEqualFails
integration_test.go:19:
c.Check("foo\nbar\nbaz\nboom\n", Equals, "foo\nbaar\nbaz\nboom\n")
... obtained string = "" +
... "foo\n" +
... "bar\n" +
... "baz\n" +
... "boom\n"
... expected string = "" +
... "foo\n" +
... "baar\n" +
... "baz\n" +
... "boom\n"
... String difference:
... [1]: "bar" != "baar"
----------------------------------------------------------------------
FAIL: integration_test.go:22: integrationTestHelper.TestStringEqualFails
integration_test.go:23:
c.Check("foo", Equals, "bar")
... obtained string = "foo"
... expected string = "bar"
----------------------------------------------------------------------
FAIL: integration_test.go:34: integrationTestHelper.TestStructEqualFails
integration_test.go:35:
c.Check(complexStruct{1, 2}, Equals, complexStruct{3, 4})
... obtained check_test.complexStruct = check_test.complexStruct{r:1, i:2}
... expected check_test.complexStruct = check_test.complexStruct{r:3, i:4}
... Difference:
... r: 1 != 3
... i: 2 != 4
func (s *integrationS) TestCountSuite(c *C) {
suitesRun += 1
}

`)
func (s *integrationS) TestOutput(c *C) {
exitCode, output := runHelperSuite("integrationTestHelper")
c.Check(exitCode, Equals, 1)

c.Check(output.Status("integrationTestHelper/TestIntEqualFails"), Equals, "FAIL")
c.Check(output.Logs("integrationTestHelper/TestIntEqualFails"), Equals,
` integration_test.go:27:
c.Check(42, Equals, 43)
... obtained int = 42
... expected int = 43`)

c.Check(output.Status("integrationTestHelper/TestMultiLineStringEqualFails"), Equals, "FAIL")
c.Check(output.Logs("integrationTestHelper/TestMultiLineStringEqualFails"), Equals,
` integration_test.go:19:
c.Check("foo\nbar\nbaz\nboom\n", Equals, "foo\nbaar\nbaz\nboom\n")
... obtained string = "" +
... "foo\n" +
... "bar\n" +
... "baz\n" +
... "boom\n"
... expected string = "" +
... "foo\n" +
... "baar\n" +
... "baz\n" +
... "boom\n"
... String difference:
... [1]: "bar" != "baar"`)

c.Check(output.Status("integrationTestHelper/TestStringEqualFails"), Equals, "FAIL")
c.Check(output.Logs("integrationTestHelper/TestStringEqualFails"), Equals,
` integration_test.go:23:
c.Check("foo", Equals, "bar")
... obtained string = "foo"
... expected string = "bar"`)

c.Check(output.Status("integrationTestHelper/TestStructEqualFails"), Equals, "FAIL")
c.Check(output.Logs("integrationTestHelper/TestStructEqualFails"), Equals,
` integration_test.go:35:
c.Check(complexStruct{1, 2}, Equals, complexStruct{3, 4})
... obtained check_test.complexStruct = check_test.complexStruct{r:1, i:2}
... expected check_test.complexStruct = check_test.complexStruct{r:3, i:4}
... Difference:
... r: 1 != 3
... i: 2 != 4`)
}
2 changes: 2 additions & 0 deletions testhelper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ func TestHelperSuite(t *testing.T) {
suite.panicOn = *helperPanicFlag
}
check.Run(t, suite)
case "integrationTestHelper":
check.Run(t, &integrationTestHelper{})
default:
t.Skip()
}
Expand Down

0 comments on commit ec280f8

Please sign in to comment.