-
-
Notifications
You must be signed in to change notification settings - Fork 650
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Handle -coverprofile flag Fixes #346 * Add tool for easier contribution * Cast byte[], otherwise failure will be displayed as array of bytes, not very useful * Fix combine not finding files if coverProfile was set * Add test for recursive coverage * Fix test imports to point to correct subpackages * Add test for cover profile in parallel mode
- Loading branch information
Showing
12 changed files
with
247 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
TODO | ||
tmp/**/* | ||
*.coverprofile | ||
.vscode | ||
.vscode | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Take current path | ||
path=$(pwd) | ||
|
||
# Split it | ||
IFS='\/'; arrIN=($path); unset IFS; | ||
|
||
# Find directory before ginkgo | ||
len=${#arrIN[@]} | ||
|
||
userDir=${arrIN[$len-2]} | ||
|
||
# Replace onsi with userdir | ||
find . -type f -name '*.go' -exec sed -i '' s/github.com\\/onsi\\/ginkgo\\/internal/github.com\\/$userDir\\/ginkgo\\/internal/ {} + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
integration/_fixtures/combined_coverage_fixture/first_package/coverage.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package first_package | ||
|
||
func A() string { | ||
return "A" | ||
} | ||
|
||
func B() string { | ||
return "B" | ||
} | ||
|
||
func C() string { | ||
return "C" | ||
} | ||
|
||
func D() string { | ||
return "D" | ||
} | ||
|
||
func E() string { | ||
return "untested" | ||
} |
13 changes: 13 additions & 0 deletions
13
integration/_fixtures/combined_coverage_fixture/first_package/coverage_fixture_suite_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package first_package_test | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
|
||
"testing" | ||
) | ||
|
||
func TestCoverageFixture(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "CombinedFixture First Suite") | ||
} |
31 changes: 31 additions & 0 deletions
31
integration/_fixtures/combined_coverage_fixture/first_package/coverage_fixture_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package first_package_test | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package" | ||
. "github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/first_package/external_coverage_fixture" | ||
|
||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
var _ = Describe("CoverageFixture", func() { | ||
It("should test A", func() { | ||
Ω(A()).Should(Equal("A")) | ||
}) | ||
|
||
It("should test B", func() { | ||
Ω(B()).Should(Equal("B")) | ||
}) | ||
|
||
It("should test C", func() { | ||
Ω(C()).Should(Equal("C")) | ||
}) | ||
|
||
It("should test D", func() { | ||
Ω(D()).Should(Equal("D")) | ||
}) | ||
|
||
It("should test external package", func() { | ||
Ω(Tested()).Should(Equal("tested")) | ||
}) | ||
}) |
9 changes: 9 additions & 0 deletions
9
...es/combined_coverage_fixture/first_package/external_coverage_fixture/external_coverage.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package external_coverage | ||
|
||
func Tested() string { | ||
return "tested" | ||
} | ||
|
||
func Untested() string { | ||
return "untested" | ||
} |
21 changes: 21 additions & 0 deletions
21
integration/_fixtures/combined_coverage_fixture/second_package/coverage.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package second_package | ||
|
||
func A() string { | ||
return "A" | ||
} | ||
|
||
func B() string { | ||
return "B" | ||
} | ||
|
||
func C() string { | ||
return "C" | ||
} | ||
|
||
func D() string { | ||
return "D" | ||
} | ||
|
||
func E() string { | ||
return "E" | ||
} |
13 changes: 13 additions & 0 deletions
13
...gration/_fixtures/combined_coverage_fixture/second_package/coverage_fixture_suite_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package second_package_test | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/gomega" | ||
|
||
"testing" | ||
) | ||
|
||
func TestCoverageFixture(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "CombinedFixture Second Suite") | ||
} |
29 changes: 29 additions & 0 deletions
29
integration/_fixtures/combined_coverage_fixture/second_package/coverage_fixture_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package second_package_test | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo" | ||
. "github.com/onsi/ginkgo/integration/_fixtures/combined_coverage_fixture/second_package" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
var _ = Describe("CoverageFixture", func() { | ||
It("should test A", func() { | ||
Ω(A()).Should(Equal("A")) | ||
}) | ||
|
||
It("should test B", func() { | ||
Ω(B()).Should(Equal("B")) | ||
}) | ||
|
||
It("should test C", func() { | ||
Ω(C()).Should(Equal("C")) | ||
}) | ||
|
||
It("should test D", func() { | ||
Ω(D()).Should(Equal("D")) | ||
}) | ||
|
||
It("should test E", func() { | ||
Ω(E()).Should(Equal("E")) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters