vendor: Mega update all dependencies
GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4080
This commit is contained in:
136
vendor/github.com/onsi/ginkgo/CHANGELOG.md
generated
vendored
136
vendor/github.com/onsi/ginkgo/CHANGELOG.md
generated
vendored
@@ -1,136 +0,0 @@
|
||||
## HEAD
|
||||
|
||||
Improvements:
|
||||
|
||||
- `Skip(message)` can be used to skip the current test.
|
||||
- Added `extensions/table` - a Ginkgo DSL for [Table Driven Tests](http://onsi.github.io/ginkgo/#table-driven-tests)
|
||||
|
||||
Bug Fixes:
|
||||
|
||||
- Ginkgo tests now fail when you `panic(nil)` (#167)
|
||||
|
||||
## 1.2.0 5/31/2015
|
||||
|
||||
Improvements
|
||||
|
||||
- `ginkgo -coverpkg` calls down to `go test -coverpkg` (#160)
|
||||
- `ginkgo -afterSuiteHook COMMAND` invokes the passed-in `COMMAND` after a test suite completes (#152)
|
||||
- Relaxed requirement for Go 1.4+. `ginkgo` now works with Go v1.3+ (#166)
|
||||
|
||||
## 1.2.0-beta
|
||||
|
||||
Ginkgo now requires Go 1.4+
|
||||
|
||||
Improvements:
|
||||
|
||||
- Call reporters in reverse order when announcing spec completion -- allows custom reporters to emit output before the default reporter does.
|
||||
- Improved focus behavior. Now, this:
|
||||
|
||||
```golang
|
||||
FDescribe("Some describe", func() {
|
||||
It("A", func() {})
|
||||
|
||||
FIt("B", func() {})
|
||||
})
|
||||
```
|
||||
|
||||
will run `B` but *not* `A`. This tends to be a common usage pattern when in the thick of writing and debugging tests.
|
||||
- When `SIGINT` is received, Ginkgo will emit the contents of the `GinkgoWriter` before running the `AfterSuite`. Useful for debugging stuck tests.
|
||||
- When `--progress` is set, Ginkgo will write test progress (in particular, Ginkgo will say when it is about to run a BeforeEach, AfterEach, It, etc...) to the `GinkgoWriter`. This is useful for debugging stuck tests and tests that generate many logs.
|
||||
- Improved output when an error occurs in a setup or teardown block.
|
||||
- When `--dryRun` is set, Ginkgo will walk the spec tree and emit to its reporter *without* actually running anything. Best paired with `-v` to understand which specs will run in which order.
|
||||
- Add `By` to help document long `It`s. `By` simply writes to the `GinkgoWriter`.
|
||||
- Add support for precompiled tests:
|
||||
- `ginkgo build <path-to-package>` will now compile the package, producing a file named `package.test`
|
||||
- The compiled `package.test` file can be run directly. This runs the tests in series.
|
||||
- To run precompiled tests in parallel, you can run: `ginkgo -p package.test`
|
||||
- Support `bootstrap`ping and `generate`ing [Agouti](http://agouti.org) specs.
|
||||
- `ginkgo generate` and `ginkgo bootstrap` now honor the package name already defined in a given directory
|
||||
- The `ginkgo` CLI ignores `SIGQUIT`. Prevents its stack dump from interlacing with the underlying test suite's stack dump.
|
||||
- The `ginkgo` CLI now compiles tests into a temporary directory instead of the package directory. This necessitates upgrading to Go v1.4+.
|
||||
- `ginkgo -notify` now works on Linux
|
||||
|
||||
Bug Fixes:
|
||||
|
||||
- If --skipPackages is used and all packages are skipped, Ginkgo should exit 0.
|
||||
- Fix tempfile leak when running in parallel
|
||||
- Fix incorrect failure message when a panic occurs during a parallel test run
|
||||
- Fixed an issue where a pending test within a focused context (or a focused test within a pending context) would skip all other tests.
|
||||
- Be more consistent about handling SIGTERM as well as SIGINT
|
||||
- When interupted while concurrently compiling test suites in the background, Ginkgo now cleans up the compiled artifacts.
|
||||
- Fixed a long standing bug where `ginkgo -p` would hang if a process spawned by one of the Ginkgo parallel nodes does not exit. (Hooray!)
|
||||
|
||||
## 1.1.0 (8/2/2014)
|
||||
|
||||
No changes, just dropping the beta.
|
||||
|
||||
## 1.1.0-beta (7/22/2014)
|
||||
New Features:
|
||||
|
||||
- `ginkgo watch` now monitors packages *and their dependencies* for changes. The depth of the dependency tree can be modified with the `-depth` flag.
|
||||
- Test suites with a programmatic focus (`FIt`, `FDescribe`, etc...) exit with non-zero status code, evne when they pass. This allows CI systems to detect accidental commits of focused test suites.
|
||||
- `ginkgo -p` runs the testsuite in parallel with an auto-detected number of nodes.
|
||||
- `ginkgo -tags=TAG_LIST` passes a list of tags down to the `go build` command.
|
||||
- `ginkgo --failFast` aborts the test suite after the first failure.
|
||||
- `ginkgo generate file_1 file_2` can take multiple file arguments.
|
||||
- Ginkgo now summarizes any spec failures that occured at the end of the test run.
|
||||
- `ginkgo --randomizeSuites` will run tests *suites* in random order using the generated/passed-in seed.
|
||||
|
||||
Improvements:
|
||||
|
||||
- `ginkgo -skipPackage` now takes a comma-separated list of strings. If the *relative path* to a package matches one of the entries in the comma-separated list, that package is skipped.
|
||||
- `ginkgo --untilItFails` no longer recompiles between attempts.
|
||||
- Ginkgo now panics when a runnable node (`It`, `BeforeEach`, `JustBeforeEach`, `AfterEach`, `Measure`) is nested within another runnable node. This is always a mistake. Any test suites that panic because of this change should be fixed.
|
||||
|
||||
Bug Fixes:
|
||||
|
||||
- `ginkgo boostrap` and `ginkgo generate` no longer fail when dealing with `hyphen-separated-packages`.
|
||||
- parallel specs are now better distributed across nodes - fixed a crashing bug where (for example) distributing 11 tests across 7 nodes would panic
|
||||
|
||||
## 1.0.0 (5/24/2014)
|
||||
New Features:
|
||||
|
||||
- Add `GinkgoParallelNode()` - shorthand for `config.GinkgoConfig.ParallelNode`
|
||||
|
||||
Improvements:
|
||||
|
||||
- When compilation fails, the compilation output is rewritten to present a correct *relative* path. Allows ⌘-clicking in iTerm open the file in your text editor.
|
||||
- `--untilItFails` and `ginkgo watch` now generate new random seeds between test runs, unless a particular random seed is specified.
|
||||
|
||||
Bug Fixes:
|
||||
|
||||
- `-cover` now generates a correctly combined coverprofile when running with in parallel with multiple `-node`s.
|
||||
- Print out the contents of the `GinkgoWriter` when `BeforeSuite` or `AfterSuite` fail.
|
||||
- Fix all remaining race conditions in Ginkgo's test suite.
|
||||
|
||||
## 1.0.0-beta (4/14/2014)
|
||||
Breaking changes:
|
||||
|
||||
- `thirdparty/gomocktestreporter` is gone. Use `GinkgoT()` instead
|
||||
- Modified the Reporter interface
|
||||
- `watch` is now a subcommand, not a flag.
|
||||
|
||||
DSL changes:
|
||||
|
||||
- `BeforeSuite` and `AfterSuite` for setting up and tearing down test suites.
|
||||
- `AfterSuite` is triggered on interrupt (`^C`) as well as exit.
|
||||
- `SynchronizedBeforeSuite` and `SynchronizedAfterSuite` for setting up and tearing down singleton resources across parallel nodes.
|
||||
|
||||
CLI changes:
|
||||
|
||||
- `watch` is now a subcommand, not a flag
|
||||
- `--nodot` flag can be passed to `ginkgo generate` and `ginkgo bootstrap` to avoid dot imports. This explicitly imports all exported identifiers in Ginkgo and Gomega. Refreshing this list can be done by running `ginkgo nodot`
|
||||
- Additional arguments can be passed to specs. Pass them after the `--` separator
|
||||
- `--skipPackage` flag takes a regexp and ignores any packages with package names passing said regexp.
|
||||
- `--trace` flag prints out full stack traces when errors occur, not just the line at which the error occurs.
|
||||
|
||||
Misc:
|
||||
|
||||
- Start using semantic versioning
|
||||
- Start maintaining changelog
|
||||
|
||||
Major refactor:
|
||||
|
||||
- Pull out Ginkgo's internal to `internal`
|
||||
- Rename `example` everywhere to `spec`
|
||||
- Much more!
|
||||
115
vendor/github.com/onsi/ginkgo/README.md
generated
vendored
115
vendor/github.com/onsi/ginkgo/README.md
generated
vendored
@@ -1,115 +0,0 @@
|
||||

|
||||
|
||||
[](https://travis-ci.org/onsi/ginkgo)
|
||||
|
||||
Jump to the [docs](http://onsi.github.io/ginkgo/) to learn more. To start rolling your Ginkgo tests *now* [keep reading](#set-me-up)!
|
||||
|
||||
To discuss Ginkgo and get updates, join the [google group](https://groups.google.com/d/forum/ginkgo-and-gomega).
|
||||
|
||||
## Feature List
|
||||
|
||||
- Ginkgo uses Go's `testing` package and can live alongside your existing `testing` tests. It's easy to [bootstrap](http://onsi.github.io/ginkgo/#bootstrapping-a-suite) and start writing your [first tests](http://onsi.github.io/ginkgo/#adding-specs-to-a-suite)
|
||||
|
||||
- Structure your BDD-style tests expressively:
|
||||
- Nestable [`Describe` and `Context` container blocks](http://onsi.github.io/ginkgo/#organizing-specs-with-containers-describe-and-context)
|
||||
- [`BeforeEach` and `AfterEach` blocks](http://onsi.github.io/ginkgo/#extracting-common-setup-beforeeach) for setup and teardown
|
||||
- [`It` blocks](http://onsi.github.io/ginkgo/#individual-specs-) that hold your assertions
|
||||
- [`JustBeforeEach` blocks](http://onsi.github.io/ginkgo/#separating-creation-and-configuration-justbeforeeach) that separate creation from configuration (also known as the subject action pattern).
|
||||
- [`BeforeSuite` and `AfterSuite` blocks](http://onsi.github.io/ginkgo/#global-setup-and-teardown-beforesuite-and-aftersuite) to prep for and cleanup after a suite.
|
||||
|
||||
- A comprehensive test runner that lets you:
|
||||
- Mark specs as [pending](http://onsi.github.io/ginkgo/#pending-specs)
|
||||
- [Focus](http://onsi.github.io/ginkgo/#focused-specs) individual specs, and groups of specs, either programmatically or on the command line
|
||||
- Run your tests in [random order](http://onsi.github.io/ginkgo/#spec-permutation), and then reuse random seeds to replicate the same order.
|
||||
- Break up your test suite into parallel processes for straightforward [test parallelization](http://onsi.github.io/ginkgo/#parallel-specs)
|
||||
|
||||
- `ginkgo`: a command line interface with plenty of handy command line arguments for [running your tests](http://onsi.github.io/ginkgo/#running-tests) and [generating](http://onsi.github.io/ginkgo/#generators) test files. Here are a few choice examples:
|
||||
- `ginkgo -nodes=N` runs your tests in `N` parallel processes and print out coherent output in realtime
|
||||
- `ginkgo -cover` runs your tests using Golang's code coverage tool
|
||||
- `ginkgo convert` converts an XUnit-style `testing` package to a Ginkgo-style package
|
||||
- `ginkgo -focus="REGEXP"` and `ginkgo -skip="REGEXP"` allow you to specify a subset of tests to run via regular expression
|
||||
- `ginkgo -r` runs all tests suites under the current directory
|
||||
- `ginkgo -v` prints out identifying information for each tests just before it runs
|
||||
|
||||
And much more: run `ginkgo help` for details!
|
||||
|
||||
The `ginkgo` CLI is convenient, but purely optional -- Ginkgo works just fine with `go test`
|
||||
|
||||
- `ginkgo watch` [watches](https://onsi.github.io/ginkgo/#watching-for-changes) packages *and their dependencies* for changes, then reruns tests. Run tests immediately as you develop!
|
||||
|
||||
- Built-in support for testing [asynchronicity](http://onsi.github.io/ginkgo/#asynchronous-tests)
|
||||
|
||||
- Built-in support for [benchmarking](http://onsi.github.io/ginkgo/#benchmark-tests) your code. Control the number of benchmark samples as you gather runtimes and other, arbitrary, bits of numerical information about your code.
|
||||
|
||||
- [Completions for Sublime Text](https://github.com/onsi/ginkgo-sublime-completions): just use [Package Control](https://sublime.wbond.net/) to install `Ginkgo Completions`.
|
||||
|
||||
- Straightforward support for third-party testing libraries such as [Gomock](https://code.google.com/p/gomock/) and [Testify](https://github.com/stretchr/testify). Check out the [docs](http://onsi.github.io/ginkgo/#third-party-integrations) for details.
|
||||
|
||||
- A modular architecture that lets you easily:
|
||||
- Write [custom reporters](http://onsi.github.io/ginkgo/#writing-custom-reporters) (for example, Ginkgo comes with a [JUnit XML reporter](http://onsi.github.io/ginkgo/#generating-junit-xml-output) and a TeamCity reporter).
|
||||
- [Adapt an existing matcher library (or write your own!)](http://onsi.github.io/ginkgo/#using-other-matcher-libraries) to work with Ginkgo
|
||||
|
||||
## [Gomega](http://github.com/onsi/gomega): Ginkgo's Preferred Matcher Library
|
||||
|
||||
Ginkgo is best paired with Gomega. Learn more about Gomega [here](http://onsi.github.io/gomega/)
|
||||
|
||||
## [Agouti](http://github.com/sclevine/agouti): A Golang Acceptance Testing Framework
|
||||
|
||||
Agouti allows you run WebDriver integration tests. Learn more about Agouti [here](http://agouti.org)
|
||||
|
||||
## Set Me Up!
|
||||
|
||||
You'll need Golang v1.3+ (Ubuntu users: you probably have Golang v1.0 -- you'll need to upgrade!)
|
||||
|
||||
```bash
|
||||
|
||||
go get github.com/onsi/ginkgo/ginkgo # installs the ginkgo CLI
|
||||
go get github.com/onsi/gomega # fetches the matcher library
|
||||
|
||||
cd path/to/package/you/want/to/test
|
||||
|
||||
ginkgo bootstrap # set up a new ginkgo suite
|
||||
ginkgo generate # will create a sample test file. edit this file and add your tests then...
|
||||
|
||||
go test # to run your tests
|
||||
|
||||
ginkgo # also runs your tests
|
||||
|
||||
```
|
||||
|
||||
## I'm new to Go: What are my testing options?
|
||||
|
||||
Of course, I heartily recommend [Ginkgo](https://github.com/onsi/ginkgo) and [Gomega](https://github.com/onsi/gomega). Both packages are seeing heavy, daily, production use on a number of projects and boast a mature and comprehensive feature-set.
|
||||
|
||||
With that said, it's great to know what your options are :)
|
||||
|
||||
### What Golang gives you out of the box
|
||||
|
||||
Testing is a first class citizen in Golang, however Go's built-in testing primitives are somewhat limited: The [testing](http://golang.org/pkg/testing) package provides basic XUnit style tests and no assertion library.
|
||||
|
||||
### Matcher libraries for Golang's XUnit style tests
|
||||
|
||||
A number of matcher libraries have been written to augment Go's built-in XUnit style tests. Here are two that have gained traction:
|
||||
|
||||
- [testify](https://github.com/stretchr/testify)
|
||||
- [gocheck](http://labix.org/gocheck)
|
||||
|
||||
You can also use Ginkgo's matcher library [Gomega](https://github.com/onsi/gomega) in [XUnit style tests](http://onsi.github.io/gomega/#using-gomega-with-golangs-xunitstyle-tests)
|
||||
|
||||
### BDD style testing frameworks
|
||||
|
||||
There are a handful of BDD-style testing frameworks written for Golang. Here are a few:
|
||||
|
||||
- [Ginkgo](https://github.com/onsi/ginkgo) ;)
|
||||
- [GoConvey](https://github.com/smartystreets/goconvey)
|
||||
- [Goblin](https://github.com/franela/goblin)
|
||||
- [Mao](https://github.com/azer/mao)
|
||||
- [Zen](https://github.com/pranavraja/zen)
|
||||
|
||||
Finally, @shageman has [put together](https://github.com/shageman/gotestit) a comprehensive comparison of golang testing libraries.
|
||||
|
||||
Go explore!
|
||||
|
||||
## License
|
||||
|
||||
Ginkgo is MIT-Licensed
|
||||
37
vendor/github.com/onsi/ginkgo/config/config.go
generated
vendored
37
vendor/github.com/onsi/ginkgo/config/config.go
generated
vendored
@@ -20,18 +20,20 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
const VERSION = "1.2.0"
|
||||
const VERSION = "1.3.1"
|
||||
|
||||
type GinkgoConfigType struct {
|
||||
RandomSeed int64
|
||||
RandomizeAllSpecs bool
|
||||
FocusString string
|
||||
SkipString string
|
||||
SkipMeasurements bool
|
||||
FailOnPending bool
|
||||
FailFast bool
|
||||
EmitSpecProgress bool
|
||||
DryRun bool
|
||||
RandomSeed int64
|
||||
RandomizeAllSpecs bool
|
||||
RegexScansFilePath bool
|
||||
FocusString string
|
||||
SkipString string
|
||||
SkipMeasurements bool
|
||||
FailOnPending bool
|
||||
FailFast bool
|
||||
FlakeAttempts int
|
||||
EmitSpecProgress bool
|
||||
DryRun bool
|
||||
|
||||
ParallelNode int
|
||||
ParallelTotal int
|
||||
@@ -66,9 +68,16 @@ func Flags(flagSet *flag.FlagSet, prefix string, includeParallelFlags bool) {
|
||||
flagSet.BoolVar(&(GinkgoConfig.SkipMeasurements), prefix+"skipMeasurements", false, "If set, ginkgo will skip any measurement specs.")
|
||||
flagSet.BoolVar(&(GinkgoConfig.FailOnPending), prefix+"failOnPending", false, "If set, ginkgo will mark the test suite as failed if any specs are pending.")
|
||||
flagSet.BoolVar(&(GinkgoConfig.FailFast), prefix+"failFast", false, "If set, ginkgo will stop running a test suite after a failure occurs.")
|
||||
|
||||
flagSet.BoolVar(&(GinkgoConfig.DryRun), prefix+"dryRun", false, "If set, ginkgo will walk the test hierarchy without actually running anything. Best paired with -v.")
|
||||
|
||||
flagSet.StringVar(&(GinkgoConfig.FocusString), prefix+"focus", "", "If set, ginkgo will only run specs that match this regular expression.")
|
||||
flagSet.StringVar(&(GinkgoConfig.SkipString), prefix+"skip", "", "If set, ginkgo will only run specs that do not match this regular expression.")
|
||||
|
||||
flagSet.BoolVar(&(GinkgoConfig.RegexScansFilePath), prefix+"regexScansFilePath", false, "If set, ginkgo regex matching also will look at the file path (code location).")
|
||||
|
||||
flagSet.IntVar(&(GinkgoConfig.FlakeAttempts), prefix+"flakeAttempts", 1, "Make up to this many attempts to run each spec. Please note that if any of the attempts succeed, the suite will not be failed. But any failures will still be recorded.")
|
||||
|
||||
flagSet.BoolVar(&(GinkgoConfig.EmitSpecProgress), prefix+"progress", false, "If set, ginkgo will emit progress information as each spec runs to the GinkgoWriter.")
|
||||
|
||||
if includeParallelFlags {
|
||||
@@ -122,6 +131,10 @@ func BuildFlagArgs(prefix string, ginkgo GinkgoConfigType, reporter DefaultRepor
|
||||
result = append(result, fmt.Sprintf("--%sskip=%s", prefix, ginkgo.SkipString))
|
||||
}
|
||||
|
||||
if ginkgo.FlakeAttempts > 1 {
|
||||
result = append(result, fmt.Sprintf("--%sflakeAttempts=%d", prefix, ginkgo.FlakeAttempts))
|
||||
}
|
||||
|
||||
if ginkgo.EmitSpecProgress {
|
||||
result = append(result, fmt.Sprintf("--%sprogress", prefix))
|
||||
}
|
||||
@@ -142,6 +155,10 @@ func BuildFlagArgs(prefix string, ginkgo GinkgoConfigType, reporter DefaultRepor
|
||||
result = append(result, fmt.Sprintf("--%sparallel.synchost=%s", prefix, ginkgo.SyncHost))
|
||||
}
|
||||
|
||||
if ginkgo.RegexScansFilePath {
|
||||
result = append(result, fmt.Sprintf("--%sregexScansFilePath", prefix))
|
||||
}
|
||||
|
||||
if reporter.NoColor {
|
||||
result = append(result, fmt.Sprintf("--%snoColor", prefix))
|
||||
}
|
||||
|
||||
13
vendor/github.com/onsi/ginkgo/extensions/table/table_suite_test.go
generated
vendored
13
vendor/github.com/onsi/ginkgo/extensions/table/table_suite_test.go
generated
vendored
@@ -1,13 +0,0 @@
|
||||
package table_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTable(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "Table Suite")
|
||||
}
|
||||
64
vendor/github.com/onsi/ginkgo/extensions/table/table_test.go
generated
vendored
64
vendor/github.com/onsi/ginkgo/extensions/table/table_test.go
generated
vendored
@@ -1,64 +0,0 @@
|
||||
package table_test
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
. "github.com/onsi/ginkgo/extensions/table"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("Table", func() {
|
||||
DescribeTable("a simple table",
|
||||
func(x int, y int, expected bool) {
|
||||
Ω(x > y).Should(Equal(expected))
|
||||
},
|
||||
Entry("x > y", 1, 0, true),
|
||||
Entry("x == y", 0, 0, false),
|
||||
Entry("x < y", 0, 1, false),
|
||||
)
|
||||
|
||||
type ComplicatedThings struct {
|
||||
Superstructure string
|
||||
Substructure string
|
||||
Count int
|
||||
}
|
||||
|
||||
DescribeTable("a more complicated table",
|
||||
func(c ComplicatedThings) {
|
||||
Ω(strings.Count(c.Superstructure, c.Substructure)).Should(BeNumerically("==", c.Count))
|
||||
},
|
||||
Entry("with no matching substructures", ComplicatedThings{
|
||||
Superstructure: "the sixth sheikh's sixth sheep's sick",
|
||||
Substructure: "emir",
|
||||
Count: 0,
|
||||
}),
|
||||
Entry("with one matching substructure", ComplicatedThings{
|
||||
Superstructure: "the sixth sheikh's sixth sheep's sick",
|
||||
Substructure: "sheep",
|
||||
Count: 1,
|
||||
}),
|
||||
Entry("with many matching substructures", ComplicatedThings{
|
||||
Superstructure: "the sixth sheikh's sixth sheep's sick",
|
||||
Substructure: "si",
|
||||
Count: 3,
|
||||
}),
|
||||
)
|
||||
|
||||
PDescribeTable("a failure",
|
||||
func(value bool) {
|
||||
Ω(value).Should(BeFalse())
|
||||
},
|
||||
Entry("when true", true),
|
||||
Entry("when false", false),
|
||||
Entry("when malformed", 2),
|
||||
)
|
||||
|
||||
DescribeTable("an untyped nil as an entry",
|
||||
func(x interface{}) {
|
||||
Expect(x).To(BeNil())
|
||||
},
|
||||
Entry("nil", nil),
|
||||
)
|
||||
})
|
||||
34
vendor/github.com/onsi/ginkgo/ginkgo/bootstrap_command.go
generated
vendored
34
vendor/github.com/onsi/ginkgo/ginkgo/bootstrap_command.go
generated
vendored
@@ -4,6 +4,7 @@ import (
|
||||
"bytes"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
@@ -15,10 +16,15 @@ import (
|
||||
)
|
||||
|
||||
func BuildBootstrapCommand() *Command {
|
||||
var agouti, noDot bool
|
||||
var (
|
||||
agouti, noDot, internal bool
|
||||
customBootstrapFile string
|
||||
)
|
||||
flagSet := flag.NewFlagSet("bootstrap", flag.ExitOnError)
|
||||
flagSet.BoolVar(&agouti, "agouti", false, "If set, bootstrap will generate a bootstrap file for writing Agouti tests")
|
||||
flagSet.BoolVar(&noDot, "nodot", false, "If set, bootstrap will generate a bootstrap file that does not . import ginkgo and gomega")
|
||||
flagSet.BoolVar(&internal, "internal", false, "If set, generate will generate a test file that uses the regular package name")
|
||||
flagSet.StringVar(&customBootstrapFile, "template", "", "If specified, generate will use the contents of the file passed as the bootstrap template")
|
||||
|
||||
return &Command{
|
||||
Name: "bootstrap",
|
||||
@@ -29,12 +35,12 @@ func BuildBootstrapCommand() *Command {
|
||||
"Accepts the following flags:",
|
||||
},
|
||||
Command: func(args []string, additionalArgs []string) {
|
||||
generateBootstrap(agouti, noDot)
|
||||
generateBootstrap(agouti, noDot, internal, customBootstrapFile)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
var bootstrapText = `package {{.Package}}_test
|
||||
var bootstrapText = `package {{.Package}}
|
||||
|
||||
import (
|
||||
{{.GinkgoImport}}
|
||||
@@ -49,7 +55,7 @@ func Test{{.FormattedName}}(t *testing.T) {
|
||||
}
|
||||
`
|
||||
|
||||
var agoutiBootstrapText = `package {{.Package}}_test
|
||||
var agoutiBootstrapText = `package {{.Package}}
|
||||
|
||||
import (
|
||||
{{.GinkgoImport}}
|
||||
@@ -115,6 +121,14 @@ func prettifyPackageName(name string) string {
|
||||
return name
|
||||
}
|
||||
|
||||
func determinePackageName(name string, internal bool) string {
|
||||
if internal {
|
||||
return name
|
||||
}
|
||||
|
||||
return name + "_test"
|
||||
}
|
||||
|
||||
func fileExists(path string) bool {
|
||||
_, err := os.Stat(path)
|
||||
if err == nil {
|
||||
@@ -123,10 +137,10 @@ func fileExists(path string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func generateBootstrap(agouti bool, noDot bool) {
|
||||
func generateBootstrap(agouti, noDot, internal bool, customBootstrapFile string) {
|
||||
packageName, bootstrapFilePrefix, formattedName := getPackageAndFormattedName()
|
||||
data := bootstrapData{
|
||||
Package: packageName,
|
||||
Package: determinePackageName(packageName, internal),
|
||||
FormattedName: formattedName,
|
||||
GinkgoImport: `. "github.com/onsi/ginkgo"`,
|
||||
GomegaImport: `. "github.com/onsi/gomega"`,
|
||||
@@ -153,7 +167,13 @@ func generateBootstrap(agouti bool, noDot bool) {
|
||||
defer f.Close()
|
||||
|
||||
var templateText string
|
||||
if agouti {
|
||||
if customBootstrapFile != "" {
|
||||
tpl, err := ioutil.ReadFile(customBootstrapFile)
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
templateText = string(tpl)
|
||||
} else if agouti {
|
||||
templateText = agoutiBootstrapText
|
||||
} else {
|
||||
templateText = bootstrapText
|
||||
|
||||
2
vendor/github.com/onsi/ginkgo/ginkgo/build_command.go
generated
vendored
2
vendor/github.com/onsi/ginkgo/ginkgo/build_command.go
generated
vendored
@@ -46,7 +46,7 @@ func (r *SpecBuilder) BuildSpecs(args []string, additionalArgs []string) {
|
||||
|
||||
passed := true
|
||||
for _, suite := range suites {
|
||||
runner := testrunner.New(suite, 1, false, r.commandFlags.Race, r.commandFlags.Cover, r.commandFlags.CoverPkg, r.commandFlags.Tags, nil)
|
||||
runner := testrunner.New(suite, 1, false, r.commandFlags.GoOpts, nil)
|
||||
fmt.Printf("Compiling %s...\n", suite.PackageName)
|
||||
|
||||
path, _ := filepath.Abs(filepath.Join(suite.Path, fmt.Sprintf("%s.test", suite.PackageName)))
|
||||
|
||||
23
vendor/github.com/onsi/ginkgo/ginkgo/generate_command.go
generated
vendored
23
vendor/github.com/onsi/ginkgo/ginkgo/generate_command.go
generated
vendored
@@ -10,10 +10,11 @@ import (
|
||||
)
|
||||
|
||||
func BuildGenerateCommand() *Command {
|
||||
var agouti, noDot bool
|
||||
var agouti, noDot, internal bool
|
||||
flagSet := flag.NewFlagSet("generate", flag.ExitOnError)
|
||||
flagSet.BoolVar(&agouti, "agouti", false, "If set, generate will generate a test file for writing Agouti tests")
|
||||
flagSet.BoolVar(&noDot, "nodot", false, "If set, generate will generate a test file that does not . import ginkgo and gomega")
|
||||
flagSet.BoolVar(&internal, "internal", false, "If set, generate will generate a test file that uses the regular package name")
|
||||
|
||||
return &Command{
|
||||
Name: "generate",
|
||||
@@ -25,15 +26,15 @@ func BuildGenerateCommand() *Command {
|
||||
"Accepts the following flags:",
|
||||
},
|
||||
Command: func(args []string, additionalArgs []string) {
|
||||
generateSpec(args, agouti, noDot)
|
||||
generateSpec(args, agouti, noDot, internal)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
var specText = `package {{.Package}}_test
|
||||
var specText = `package {{.Package}}
|
||||
|
||||
import (
|
||||
. "{{.PackageImportPath}}"
|
||||
{{if .DotImportPackage}}. "{{.PackageImportPath}}"{{end}}
|
||||
|
||||
{{if .IncludeImports}}. "github.com/onsi/ginkgo"{{end}}
|
||||
{{if .IncludeImports}}. "github.com/onsi/gomega"{{end}}
|
||||
@@ -47,7 +48,7 @@ var _ = Describe("{{.Subject}}", func() {
|
||||
var agoutiSpecText = `package {{.Package}}_test
|
||||
|
||||
import (
|
||||
. "{{.PackageImportPath}}"
|
||||
{{if .DotImportPackage}}. "{{.PackageImportPath}}"{{end}}
|
||||
|
||||
{{if .IncludeImports}}. "github.com/onsi/ginkgo"{{end}}
|
||||
{{if .IncludeImports}}. "github.com/onsi/gomega"{{end}}
|
||||
@@ -75,11 +76,12 @@ type specData struct {
|
||||
Subject string
|
||||
PackageImportPath string
|
||||
IncludeImports bool
|
||||
DotImportPackage bool
|
||||
}
|
||||
|
||||
func generateSpec(args []string, agouti, noDot bool) {
|
||||
func generateSpec(args []string, agouti, noDot, internal bool) {
|
||||
if len(args) == 0 {
|
||||
err := generateSpecForSubject("", agouti, noDot)
|
||||
err := generateSpecForSubject("", agouti, noDot, internal)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
fmt.Println("")
|
||||
@@ -91,7 +93,7 @@ func generateSpec(args []string, agouti, noDot bool) {
|
||||
|
||||
var failed bool
|
||||
for _, arg := range args {
|
||||
err := generateSpecForSubject(arg, agouti, noDot)
|
||||
err := generateSpecForSubject(arg, agouti, noDot, internal)
|
||||
if err != nil {
|
||||
failed = true
|
||||
fmt.Println(err.Error())
|
||||
@@ -103,7 +105,7 @@ func generateSpec(args []string, agouti, noDot bool) {
|
||||
}
|
||||
}
|
||||
|
||||
func generateSpecForSubject(subject string, agouti, noDot bool) error {
|
||||
func generateSpecForSubject(subject string, agouti, noDot, internal bool) error {
|
||||
packageName, specFilePrefix, formattedName := getPackageAndFormattedName()
|
||||
if subject != "" {
|
||||
subject = strings.Split(subject, ".go")[0]
|
||||
@@ -113,10 +115,11 @@ func generateSpecForSubject(subject string, agouti, noDot bool) error {
|
||||
}
|
||||
|
||||
data := specData{
|
||||
Package: packageName,
|
||||
Package: determinePackageName(packageName, internal),
|
||||
Subject: formattedName,
|
||||
PackageImportPath: getPackageImportPath(),
|
||||
IncludeImports: !noDot,
|
||||
DotImportPackage: !internal,
|
||||
}
|
||||
|
||||
targetFile := fmt.Sprintf("%s_test.go", specFilePrefix)
|
||||
|
||||
2
vendor/github.com/onsi/ginkgo/ginkgo/help_command.go
generated
vendored
2
vendor/github.com/onsi/ginkgo/ginkgo/help_command.go
generated
vendored
@@ -9,7 +9,7 @@ func BuildHelpCommand() *Command {
|
||||
return &Command{
|
||||
Name: "help",
|
||||
FlagSet: flag.NewFlagSet("help", flag.ExitOnError),
|
||||
UsageCommand: "ginkgo help <COMAND>",
|
||||
UsageCommand: "ginkgo help <COMMAND>",
|
||||
Usage: []string{
|
||||
"Print usage information. If a command is passed in, print usage information just for that command.",
|
||||
},
|
||||
|
||||
2
vendor/github.com/onsi/ginkgo/ginkgo/interrupthandler/sigquit_swallower_unix.go
generated
vendored
2
vendor/github.com/onsi/ginkgo/ginkgo/interrupthandler/sigquit_swallower_unix.go
generated
vendored
@@ -1,4 +1,4 @@
|
||||
// +build freebsd openbsd netbsd dragonfly darwin linux
|
||||
// +build freebsd openbsd netbsd dragonfly darwin linux solaris
|
||||
|
||||
package interrupthandler
|
||||
|
||||
|
||||
11
vendor/github.com/onsi/ginkgo/ginkgo/main.go
generated
vendored
11
vendor/github.com/onsi/ginkgo/ginkgo/main.go
generated
vendored
@@ -234,7 +234,7 @@ func complainAndQuit(complaint string) {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
func findSuites(args []string, recurse bool, skipPackage string, allowPrecompiled bool) ([]testsuite.TestSuite, []string) {
|
||||
func findSuites(args []string, recurseForAll bool, skipPackage string, allowPrecompiled bool) ([]testsuite.TestSuite, []string) {
|
||||
suites := []testsuite.TestSuite{}
|
||||
|
||||
if len(args) > 0 {
|
||||
@@ -246,10 +246,15 @@ func findSuites(args []string, recurse bool, skipPackage string, allowPrecompile
|
||||
continue
|
||||
}
|
||||
}
|
||||
suites = append(suites, testsuite.SuitesInDir(arg, recurse)...)
|
||||
recurseForSuite := recurseForAll
|
||||
if strings.HasSuffix(arg, "/...") && arg != "/..." {
|
||||
arg = arg[:len(arg)-4]
|
||||
recurseForSuite = true
|
||||
}
|
||||
suites = append(suites, testsuite.SuitesInDir(arg, recurseForSuite)...)
|
||||
}
|
||||
} else {
|
||||
suites = testsuite.SuitesInDir(".", recurse)
|
||||
suites = testsuite.SuitesInDir(".", recurseForAll)
|
||||
}
|
||||
|
||||
skippedPackages := []string{}
|
||||
|
||||
91
vendor/github.com/onsi/ginkgo/ginkgo/nodot/nodot_suite_test.go
generated
vendored
91
vendor/github.com/onsi/ginkgo/ginkgo/nodot/nodot_suite_test.go
generated
vendored
@@ -1,91 +0,0 @@
|
||||
package nodot_test
|
||||
|
||||
import (
|
||||
"github.com/onsi/ginkgo"
|
||||
"github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNodot(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "Nodot Suite")
|
||||
}
|
||||
|
||||
// Declarations for Ginkgo DSL
|
||||
type Done ginkgo.Done
|
||||
type Benchmarker ginkgo.Benchmarker
|
||||
|
||||
var GinkgoWriter = ginkgo.GinkgoWriter
|
||||
var GinkgoParallelNode = ginkgo.GinkgoParallelNode
|
||||
var GinkgoT = ginkgo.GinkgoT
|
||||
var CurrentGinkgoTestDescription = ginkgo.CurrentGinkgoTestDescription
|
||||
var RunSpecs = ginkgo.RunSpecs
|
||||
var RunSpecsWithDefaultAndCustomReporters = ginkgo.RunSpecsWithDefaultAndCustomReporters
|
||||
var RunSpecsWithCustomReporters = ginkgo.RunSpecsWithCustomReporters
|
||||
var Fail = ginkgo.Fail
|
||||
var GinkgoRecover = ginkgo.GinkgoRecover
|
||||
var Describe = ginkgo.Describe
|
||||
var FDescribe = ginkgo.FDescribe
|
||||
var PDescribe = ginkgo.PDescribe
|
||||
var XDescribe = ginkgo.XDescribe
|
||||
var Context = ginkgo.Context
|
||||
var FContext = ginkgo.FContext
|
||||
var PContext = ginkgo.PContext
|
||||
var XContext = ginkgo.XContext
|
||||
var It = ginkgo.It
|
||||
var FIt = ginkgo.FIt
|
||||
var PIt = ginkgo.PIt
|
||||
var XIt = ginkgo.XIt
|
||||
var Measure = ginkgo.Measure
|
||||
var FMeasure = ginkgo.FMeasure
|
||||
var PMeasure = ginkgo.PMeasure
|
||||
var XMeasure = ginkgo.XMeasure
|
||||
var BeforeSuite = ginkgo.BeforeSuite
|
||||
var AfterSuite = ginkgo.AfterSuite
|
||||
var SynchronizedBeforeSuite = ginkgo.SynchronizedBeforeSuite
|
||||
var SynchronizedAfterSuite = ginkgo.SynchronizedAfterSuite
|
||||
var BeforeEach = ginkgo.BeforeEach
|
||||
var JustBeforeEach = ginkgo.JustBeforeEach
|
||||
var AfterEach = ginkgo.AfterEach
|
||||
|
||||
// Declarations for Gomega DSL
|
||||
var RegisterFailHandler = gomega.RegisterFailHandler
|
||||
var RegisterTestingT = gomega.RegisterTestingT
|
||||
var InterceptGomegaFailures = gomega.InterceptGomegaFailures
|
||||
var Ω = gomega.Ω
|
||||
var Expect = gomega.Expect
|
||||
var ExpectWithOffset = gomega.ExpectWithOffset
|
||||
var Eventually = gomega.Eventually
|
||||
var EventuallyWithOffset = gomega.EventuallyWithOffset
|
||||
var Consistently = gomega.Consistently
|
||||
var ConsistentlyWithOffset = gomega.ConsistentlyWithOffset
|
||||
var SetDefaultEventuallyTimeout = gomega.SetDefaultEventuallyTimeout
|
||||
var SetDefaultEventuallyPollingInterval = gomega.SetDefaultEventuallyPollingInterval
|
||||
var SetDefaultConsistentlyDuration = gomega.SetDefaultConsistentlyDuration
|
||||
var SetDefaultConsistentlyPollingInterval = gomega.SetDefaultConsistentlyPollingInterval
|
||||
|
||||
// Declarations for Gomega Matchers
|
||||
var Equal = gomega.Equal
|
||||
var BeEquivalentTo = gomega.BeEquivalentTo
|
||||
var BeNil = gomega.BeNil
|
||||
var BeTrue = gomega.BeTrue
|
||||
var BeFalse = gomega.BeFalse
|
||||
var HaveOccurred = gomega.HaveOccurred
|
||||
var MatchError = gomega.MatchError
|
||||
var BeClosed = gomega.BeClosed
|
||||
var Receive = gomega.Receive
|
||||
var MatchRegexp = gomega.MatchRegexp
|
||||
var ContainSubstring = gomega.ContainSubstring
|
||||
var MatchJSON = gomega.MatchJSON
|
||||
var BeEmpty = gomega.BeEmpty
|
||||
var HaveLen = gomega.HaveLen
|
||||
var BeZero = gomega.BeZero
|
||||
var ContainElement = gomega.ContainElement
|
||||
var ConsistOf = gomega.ConsistOf
|
||||
var HaveKey = gomega.HaveKey
|
||||
var HaveKeyWithValue = gomega.HaveKeyWithValue
|
||||
var BeNumerically = gomega.BeNumerically
|
||||
var BeTemporally = gomega.BeTemporally
|
||||
var BeAssignableToTypeOf = gomega.BeAssignableToTypeOf
|
||||
var Panic = gomega.Panic
|
||||
81
vendor/github.com/onsi/ginkgo/ginkgo/nodot/nodot_test.go
generated
vendored
81
vendor/github.com/onsi/ginkgo/ginkgo/nodot/nodot_test.go
generated
vendored
@@ -1,81 +0,0 @@
|
||||
package nodot_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo/ginkgo/nodot"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var _ = Describe("ApplyNoDot", func() {
|
||||
var result string
|
||||
|
||||
apply := func(input string) string {
|
||||
output, err := ApplyNoDot([]byte(input))
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
return string(output)
|
||||
}
|
||||
|
||||
Context("when no declarations have been imported yet", func() {
|
||||
BeforeEach(func() {
|
||||
result = apply("")
|
||||
})
|
||||
|
||||
It("should add headings for the various declarations", func() {
|
||||
Ω(result).Should(ContainSubstring("// Declarations for Ginkgo DSL"))
|
||||
Ω(result).Should(ContainSubstring("// Declarations for Gomega DSL"))
|
||||
Ω(result).Should(ContainSubstring("// Declarations for Gomega Matchers"))
|
||||
})
|
||||
|
||||
It("should import Ginkgo's declarations", func() {
|
||||
Ω(result).Should(ContainSubstring("var It = ginkgo.It"))
|
||||
Ω(result).Should(ContainSubstring("var XDescribe = ginkgo.XDescribe"))
|
||||
})
|
||||
|
||||
It("should import Ginkgo's types", func() {
|
||||
Ω(result).Should(ContainSubstring("type Done ginkgo.Done"))
|
||||
Ω(result).Should(ContainSubstring("type Benchmarker ginkgo.Benchmarker"))
|
||||
Ω(strings.Count(result, "type ")).Should(Equal(2))
|
||||
})
|
||||
|
||||
It("should import Gomega's DSL and matchers", func() {
|
||||
Ω(result).Should(ContainSubstring("var Ω = gomega.Ω"))
|
||||
Ω(result).Should(ContainSubstring("var ContainSubstring = gomega.ContainSubstring"))
|
||||
Ω(result).Should(ContainSubstring("var Equal = gomega.Equal"))
|
||||
})
|
||||
|
||||
It("should not import blacklisted things", func() {
|
||||
Ω(result).ShouldNot(ContainSubstring("GINKGO_VERSION"))
|
||||
Ω(result).ShouldNot(ContainSubstring("GINKGO_PANIC"))
|
||||
Ω(result).ShouldNot(ContainSubstring("GOMEGA_VERSION"))
|
||||
})
|
||||
})
|
||||
|
||||
It("should be idempotent (module empty lines - go fmt can fix those for us)", func() {
|
||||
first := apply("")
|
||||
second := apply(first)
|
||||
first = strings.Trim(first, "\n")
|
||||
second = strings.Trim(second, "\n")
|
||||
Ω(first).Should(Equal(second))
|
||||
})
|
||||
|
||||
It("should not mess with other things in the input", func() {
|
||||
result = apply("var MyThing = SomethingThatsMine")
|
||||
Ω(result).Should(ContainSubstring("var MyThing = SomethingThatsMine"))
|
||||
})
|
||||
|
||||
Context("when the user has redefined a name", func() {
|
||||
It("should honor the redefinition", func() {
|
||||
result = apply(`
|
||||
var _ = gomega.Ω
|
||||
var When = ginkgo.It
|
||||
`)
|
||||
|
||||
Ω(result).Should(ContainSubstring("var _ = gomega.Ω"))
|
||||
Ω(result).ShouldNot(ContainSubstring("var Ω = gomega.Ω"))
|
||||
|
||||
Ω(result).Should(ContainSubstring("var When = ginkgo.It"))
|
||||
Ω(result).ShouldNot(ContainSubstring("var It = ginkgo.It"))
|
||||
|
||||
Ω(result).Should(ContainSubstring("var Context = ginkgo.Context"))
|
||||
})
|
||||
})
|
||||
})
|
||||
2
vendor/github.com/onsi/ginkgo/ginkgo/run_command.go
generated
vendored
2
vendor/github.com/onsi/ginkgo/ginkgo/run_command.go
generated
vendored
@@ -71,7 +71,7 @@ func (r *SpecRunner) RunSpecs(args []string, additionalArgs []string) {
|
||||
|
||||
runners := []*testrunner.TestRunner{}
|
||||
for _, suite := range suites {
|
||||
runners = append(runners, testrunner.New(suite, r.commandFlags.NumCPU, r.commandFlags.ParallelStream, r.commandFlags.Race, r.commandFlags.Cover, r.commandFlags.CoverPkg, r.commandFlags.Tags, additionalArgs))
|
||||
runners = append(runners, testrunner.New(suite, r.commandFlags.NumCPU, r.commandFlags.ParallelStream, r.commandFlags.GoOpts, additionalArgs))
|
||||
}
|
||||
|
||||
numSuites := 0
|
||||
|
||||
57
vendor/github.com/onsi/ginkgo/ginkgo/run_watch_and_build_command_flags.go
generated
vendored
57
vendor/github.com/onsi/ginkgo/ginkgo/run_watch_and_build_command_flags.go
generated
vendored
@@ -9,11 +9,8 @@ import (
|
||||
|
||||
type RunWatchAndBuildCommandFlags struct {
|
||||
Recurse bool
|
||||
Race bool
|
||||
Cover bool
|
||||
CoverPkg string
|
||||
SkipPackage string
|
||||
Tags string
|
||||
GoOpts map[string]interface{}
|
||||
|
||||
//for run and watch commands
|
||||
NumCPU int
|
||||
@@ -87,15 +84,57 @@ func (c *RunWatchAndBuildCommandFlags) computeNodes() {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *RunWatchAndBuildCommandFlags) stringSlot(slot string) *string {
|
||||
var opt string
|
||||
c.GoOpts[slot] = &opt
|
||||
return &opt
|
||||
}
|
||||
|
||||
func (c *RunWatchAndBuildCommandFlags) boolSlot(slot string) *bool {
|
||||
var opt bool
|
||||
c.GoOpts[slot] = &opt
|
||||
return &opt
|
||||
}
|
||||
|
||||
func (c *RunWatchAndBuildCommandFlags) intSlot(slot string) *int {
|
||||
var opt int
|
||||
c.GoOpts[slot] = &opt
|
||||
return &opt
|
||||
}
|
||||
|
||||
func (c *RunWatchAndBuildCommandFlags) flags(mode int) {
|
||||
c.GoOpts = make(map[string]interface{})
|
||||
|
||||
onWindows := (runtime.GOOS == "windows")
|
||||
|
||||
c.FlagSet.BoolVar(&(c.Recurse), "r", false, "Find and run test suites under the current directory recursively")
|
||||
c.FlagSet.BoolVar(&(c.Race), "race", false, "Run tests with race detection enabled")
|
||||
c.FlagSet.BoolVar(&(c.Cover), "cover", false, "Run tests with coverage analysis, will generate coverage profiles with the package name in the current directory")
|
||||
c.FlagSet.StringVar(&(c.CoverPkg), "coverpkg", "", "Run tests with coverage on the given external modules")
|
||||
c.FlagSet.BoolVar(&(c.Recurse), "r", false, "Find and run test suites under the current directory recursively.")
|
||||
c.FlagSet.BoolVar(c.boolSlot("race"), "race", false, "Run tests with race detection enabled.")
|
||||
c.FlagSet.BoolVar(c.boolSlot("cover"), "cover", false, "Run tests with coverage analysis, will generate coverage profiles with the package name in the current directory.")
|
||||
c.FlagSet.StringVar(c.stringSlot("coverpkg"), "coverpkg", "", "Run tests with coverage on the given external modules.")
|
||||
c.FlagSet.StringVar(&(c.SkipPackage), "skipPackage", "", "A comma-separated list of package names to be skipped. If any part of the package's path matches, that package is ignored.")
|
||||
c.FlagSet.StringVar(&(c.Tags), "tags", "", "A list of build tags to consider satisfied during the build")
|
||||
c.FlagSet.StringVar(c.stringSlot("tags"), "tags", "", "A list of build tags to consider satisfied during the build.")
|
||||
c.FlagSet.StringVar(c.stringSlot("gcflags"), "gcflags", "", "Arguments to pass on each go tool compile invocation.")
|
||||
c.FlagSet.StringVar(c.stringSlot("covermode"), "covermode", "", "Set the mode for coverage analysis.")
|
||||
c.FlagSet.BoolVar(c.boolSlot("a"), "a", false, "Force rebuilding of packages that are already up-to-date.")
|
||||
c.FlagSet.BoolVar(c.boolSlot("n"), "n", false, "Have `go test` print the commands but do not run them.")
|
||||
c.FlagSet.BoolVar(c.boolSlot("msan"), "msan", false, "Enable interoperation with memory sanitizer.")
|
||||
c.FlagSet.BoolVar(c.boolSlot("x"), "x", false, "Have `go test` print the commands.")
|
||||
c.FlagSet.BoolVar(c.boolSlot("work"), "work", false, "Print the name of the temporary work directory and do not delete it when exiting.")
|
||||
c.FlagSet.StringVar(c.stringSlot("asmflags"), "asmflags", "", "Arguments to pass on each go tool asm invocation.")
|
||||
c.FlagSet.StringVar(c.stringSlot("buildmode"), "buildmode", "", "Build mode to use. See 'go help buildmode' for more.")
|
||||
c.FlagSet.StringVar(c.stringSlot("compiler"), "compiler", "", "Name of compiler to use, as in runtime.Compiler (gccgo or gc).")
|
||||
c.FlagSet.StringVar(c.stringSlot("gccgoflags"), "gccgoflags", "", "Arguments to pass on each gccgo compiler/linker invocation.")
|
||||
c.FlagSet.StringVar(c.stringSlot("installsuffix"), "installsuffix", "", "A suffix to use in the name of the package installation directory.")
|
||||
c.FlagSet.StringVar(c.stringSlot("ldflags"), "ldflags", "", "Arguments to pass on each go tool link invocation.")
|
||||
c.FlagSet.BoolVar(c.boolSlot("linkshared"), "linkshared", false, "Link against shared libraries previously created with -buildmode=shared.")
|
||||
c.FlagSet.StringVar(c.stringSlot("pkgdir"), "pkgdir", "", "install and load all packages from the given dir instead of the usual locations.")
|
||||
c.FlagSet.StringVar(c.stringSlot("toolexec"), "toolexec", "", "a program to use to invoke toolchain programs like vet and asm.")
|
||||
c.FlagSet.IntVar(c.intSlot("blockprofilerate"), "blockprofilerate", 1, "Control the detail provided in goroutine blocking profiles by calling runtime.SetBlockProfileRate with the given value.")
|
||||
c.FlagSet.StringVar(c.stringSlot("coverprofile"), "coverprofile", "", "Write a coverage profile to the specified file after all tests have passed.")
|
||||
c.FlagSet.StringVar(c.stringSlot("cpuprofile"), "cpuprofile", "", "Write a CPU profile to the specified file before exiting.")
|
||||
c.FlagSet.StringVar(c.stringSlot("memprofile"), "memprofile", "", "Write a memory profile to the specified file after all tests have passed.")
|
||||
c.FlagSet.IntVar(c.intSlot("memprofilerate"), "memprofilerate", 0, "Enable more precise (and expensive) memory profiles by setting runtime.MemProfileRate.")
|
||||
c.FlagSet.StringVar(c.stringSlot("outputdir"), "outputdir", "", "Place output files from profiling in the specified directory.")
|
||||
|
||||
if mode == runMode || mode == watchMode {
|
||||
config.Flags(c.FlagSet, "", false)
|
||||
|
||||
3
vendor/github.com/onsi/ginkgo/ginkgo/suite_runner.go
generated
vendored
3
vendor/github.com/onsi/ginkgo/ginkgo/suite_runner.go
generated
vendored
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/onsi/ginkgo/ginkgo/interrupthandler"
|
||||
"github.com/onsi/ginkgo/ginkgo/testrunner"
|
||||
"github.com/onsi/ginkgo/ginkgo/testsuite"
|
||||
colorable "github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable"
|
||||
)
|
||||
|
||||
type compilationInput struct {
|
||||
@@ -166,7 +167,7 @@ func (r *SuiteRunner) listFailedSuites(suitesThatFailed []testsuite.TestSuite) {
|
||||
if config.DefaultReporterConfig.NoColor {
|
||||
fmt.Printf("\t"+packageNameFormatter+" %s\n", suite.PackageName, suite.Path)
|
||||
} else {
|
||||
fmt.Printf("\t%s"+packageNameFormatter+"%s %s%s%s\n", redColor, suite.PackageName, defaultStyle, lightGrayColor, suite.Path, defaultStyle)
|
||||
fmt.Fprintf(colorable.NewColorableStdout(), "\t%s"+packageNameFormatter+"%s %s%s%s\n", redColor, suite.PackageName, defaultStyle, lightGrayColor, suite.Path, defaultStyle)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
110
vendor/github.com/onsi/ginkgo/ginkgo/testrunner/test_runner.go
generated
vendored
110
vendor/github.com/onsi/ginkgo/ginkgo/testrunner/test_runner.go
generated
vendored
@@ -29,29 +29,23 @@ type TestRunner struct {
|
||||
|
||||
numCPU int
|
||||
parallelStream bool
|
||||
race bool
|
||||
cover bool
|
||||
coverPkg string
|
||||
tags string
|
||||
goOpts map[string]interface{}
|
||||
additionalArgs []string
|
||||
}
|
||||
|
||||
func New(suite testsuite.TestSuite, numCPU int, parallelStream bool, race bool, cover bool, coverPkg string, tags string, additionalArgs []string) *TestRunner {
|
||||
func New(suite testsuite.TestSuite, numCPU int, parallelStream bool, goOpts map[string]interface{}, additionalArgs []string) *TestRunner {
|
||||
runner := &TestRunner{
|
||||
Suite: suite,
|
||||
numCPU: numCPU,
|
||||
parallelStream: parallelStream,
|
||||
race: race,
|
||||
cover: cover,
|
||||
coverPkg: coverPkg,
|
||||
tags: tags,
|
||||
goOpts: goOpts,
|
||||
additionalArgs: additionalArgs,
|
||||
}
|
||||
|
||||
if !suite.Precompiled {
|
||||
dir, err := ioutil.TempDir("", "ginkgo")
|
||||
if err != nil {
|
||||
panic(fmt.Sprintf("coulnd't create temporary directory... might be time to rm -rf:\n%s", err.Error()))
|
||||
panic(fmt.Sprintf("couldn't create temporary directory... might be time to rm -rf:\n%s", err.Error()))
|
||||
}
|
||||
runner.compilationTargetPath = filepath.Join(dir, suite.PackageName+".test")
|
||||
}
|
||||
@@ -63,6 +57,70 @@ func (t *TestRunner) Compile() error {
|
||||
return t.CompileTo(t.compilationTargetPath)
|
||||
}
|
||||
|
||||
func (t *TestRunner) BuildArgs(path string) []string {
|
||||
args := []string{"test", "-c", "-i", "-o", path, t.Suite.Path}
|
||||
|
||||
if *t.goOpts["covermode"].(*string) != "" {
|
||||
args = append(args, "-cover", fmt.Sprintf("-covermode=%s", *t.goOpts["covermode"].(*string)))
|
||||
} else {
|
||||
if *t.goOpts["cover"].(*bool) || *t.goOpts["coverpkg"].(*string) != "" {
|
||||
args = append(args, "-cover", "-covermode=atomic")
|
||||
}
|
||||
}
|
||||
|
||||
boolOpts := []string{
|
||||
"a",
|
||||
"n",
|
||||
"msan",
|
||||
"race",
|
||||
"x",
|
||||
"work",
|
||||
"linkshared",
|
||||
}
|
||||
|
||||
for _, opt := range boolOpts {
|
||||
if s, found := t.goOpts[opt].(*bool); found && *s {
|
||||
args = append(args, fmt.Sprintf("-%s", opt))
|
||||
}
|
||||
}
|
||||
|
||||
intOpts := []string{
|
||||
"memprofilerate",
|
||||
"blockprofilerate",
|
||||
}
|
||||
|
||||
for _, opt := range intOpts {
|
||||
if s, found := t.goOpts[opt].(*int); found {
|
||||
args = append(args, fmt.Sprintf("-%s=%d", opt, *s))
|
||||
}
|
||||
}
|
||||
|
||||
stringOpts := []string{
|
||||
"asmflags",
|
||||
"buildmode",
|
||||
"compiler",
|
||||
"gccgoflags",
|
||||
"installsuffix",
|
||||
"ldflags",
|
||||
"pkgdir",
|
||||
"toolexec",
|
||||
"coverprofile",
|
||||
"cpuprofile",
|
||||
"memprofile",
|
||||
"outputdir",
|
||||
"coverpkg",
|
||||
"tags",
|
||||
"gcflags",
|
||||
}
|
||||
|
||||
for _, opt := range stringOpts {
|
||||
if s, found := t.goOpts[opt].(*string); found && *s != "" {
|
||||
args = append(args, fmt.Sprintf("-%s=%s", opt, *s))
|
||||
}
|
||||
}
|
||||
return args
|
||||
}
|
||||
|
||||
func (t *TestRunner) CompileTo(path string) error {
|
||||
if t.compiled {
|
||||
return nil
|
||||
@@ -72,20 +130,7 @@ func (t *TestRunner) CompileTo(path string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
args := []string{"test", "-c", "-i", "-o", path, t.Suite.Path}
|
||||
if t.race {
|
||||
args = append(args, "-race")
|
||||
}
|
||||
if t.cover || t.coverPkg != "" {
|
||||
args = append(args, "-cover", "-covermode=atomic")
|
||||
}
|
||||
if t.coverPkg != "" {
|
||||
args = append(args, fmt.Sprintf("-coverpkg=%s", t.coverPkg))
|
||||
}
|
||||
if t.tags != "" {
|
||||
args = append(args, fmt.Sprintf("-tags=%s", t.tags))
|
||||
}
|
||||
|
||||
args := t.BuildArgs(path)
|
||||
cmd := exec.Command("go", args...)
|
||||
|
||||
output, err := cmd.CombinedOutput()
|
||||
@@ -184,6 +229,7 @@ fixCompilationOutput..... rewrites the output to fix the paths.
|
||||
yeah......
|
||||
*/
|
||||
func fixCompilationOutput(output string, relToPath string) string {
|
||||
relToPath = filepath.Join(relToPath)
|
||||
re := regexp.MustCompile(`^(\S.*\.go)\:\d+\:`)
|
||||
lines := strings.Split(output, "\n")
|
||||
for i, line := range lines {
|
||||
@@ -193,8 +239,10 @@ func fixCompilationOutput(output string, relToPath string) string {
|
||||
}
|
||||
|
||||
path := line[indices[2]:indices[3]]
|
||||
path = filepath.Join(relToPath, path)
|
||||
lines[i] = path + line[indices[3]:]
|
||||
if filepath.Dir(path) != relToPath {
|
||||
path = filepath.Join(relToPath, path)
|
||||
lines[i] = path + line[indices[3]:]
|
||||
}
|
||||
}
|
||||
return strings.Join(lines, "\n")
|
||||
}
|
||||
@@ -276,7 +324,7 @@ func (t *TestRunner) runAndStreamParallelGinkgoSuite() RunResult {
|
||||
|
||||
os.Stdout.Sync()
|
||||
|
||||
if t.cover || t.coverPkg != "" {
|
||||
if *t.goOpts["cover"].(*bool) || *t.goOpts["coverpkg"].(*string) != "" || *t.goOpts["covermode"].(*string) != "" {
|
||||
t.combineCoverprofiles()
|
||||
}
|
||||
|
||||
@@ -289,7 +337,7 @@ func (t *TestRunner) runParallelGinkgoSuite() RunResult {
|
||||
writers := make([]*logWriter, t.numCPU)
|
||||
reports := make([]*bytes.Buffer, t.numCPU)
|
||||
|
||||
stenographer := stenographer.New(!config.DefaultReporterConfig.NoColor)
|
||||
stenographer := stenographer.New(!config.DefaultReporterConfig.NoColor, config.GinkgoConfig.FlakeAttempts > 1)
|
||||
aggregator := remote.NewAggregator(t.numCPU, result, config.DefaultReporterConfig, stenographer)
|
||||
|
||||
server, err := remote.NewServer(t.numCPU)
|
||||
@@ -344,7 +392,7 @@ func (t *TestRunner) runParallelGinkgoSuite() RunResult {
|
||||
| |
|
||||
-------------------------------------------------------------------
|
||||
`)
|
||||
|
||||
fmt.Println(t.Suite.PackageName, "timed out. path:", t.Suite.Path)
|
||||
os.Stdout.Sync()
|
||||
|
||||
for _, writer := range writers {
|
||||
@@ -358,7 +406,7 @@ func (t *TestRunner) runParallelGinkgoSuite() RunResult {
|
||||
os.Stdout.Sync()
|
||||
}
|
||||
|
||||
if t.cover || t.coverPkg != "" {
|
||||
if *t.goOpts["cover"].(*bool) || *t.goOpts["coverpkg"].(*string) != "" || *t.goOpts["covermode"].(*string) != "" {
|
||||
t.combineCoverprofiles()
|
||||
}
|
||||
|
||||
@@ -367,7 +415,7 @@ func (t *TestRunner) runParallelGinkgoSuite() RunResult {
|
||||
|
||||
func (t *TestRunner) cmd(ginkgoArgs []string, stream io.Writer, node int) *exec.Cmd {
|
||||
args := []string{"--test.timeout=24h"}
|
||||
if t.cover || t.coverPkg != "" {
|
||||
if *t.goOpts["cover"].(*bool) || *t.goOpts["coverpkg"].(*string) != "" || *t.goOpts["covermode"].(*string) != "" {
|
||||
coverprofile := "--test.coverprofile=" + t.Suite.PackageName + ".coverprofile"
|
||||
if t.numCPU > 1 {
|
||||
coverprofile = fmt.Sprintf("%s.%d", coverprofile, node)
|
||||
|
||||
7
vendor/github.com/onsi/ginkgo/ginkgo/testsuite/test_suite.go
generated
vendored
7
vendor/github.com/onsi/ginkgo/ginkgo/testsuite/test_suite.go
generated
vendored
@@ -4,7 +4,6 @@ import (
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
@@ -49,11 +48,7 @@ func PrecompiledTestSuite(path string) (TestSuite, error) {
|
||||
func SuitesInDir(dir string, recurse bool) []TestSuite {
|
||||
suites := []TestSuite{}
|
||||
|
||||
// "This change will only be enabled if the go command is run with
|
||||
// GO15VENDOREXPERIMENT=1 in its environment."
|
||||
// c.f. the vendor-experiment proposal https://goo.gl/2ucMeC
|
||||
vendorExperiment := os.Getenv("GO15VENDOREXPERIMENT")
|
||||
if (vendorExperiment == "1") && path.Base(dir) == "vendor" {
|
||||
if vendorExperimentCheck(dir) {
|
||||
return suites
|
||||
}
|
||||
|
||||
|
||||
13
vendor/github.com/onsi/ginkgo/ginkgo/testsuite/testsuite_suite_test.go
generated
vendored
13
vendor/github.com/onsi/ginkgo/ginkgo/testsuite/testsuite_suite_test.go
generated
vendored
@@ -1,13 +0,0 @@
|
||||
package testsuite_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTestsuite(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "Testsuite Suite")
|
||||
}
|
||||
200
vendor/github.com/onsi/ginkgo/ginkgo/testsuite/testsuite_test.go
generated
vendored
200
vendor/github.com/onsi/ginkgo/ginkgo/testsuite/testsuite_test.go
generated
vendored
@@ -1,200 +0,0 @@
|
||||
package testsuite_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/ginkgo/ginkgo/testsuite"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("TestSuite", func() {
|
||||
var tmpDir string
|
||||
var relTmpDir string
|
||||
|
||||
writeFile := func(folder string, filename string, content string, mode os.FileMode) {
|
||||
path := filepath.Join(tmpDir, folder)
|
||||
err := os.MkdirAll(path, 0700)
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
|
||||
path = filepath.Join(path, filename)
|
||||
ioutil.WriteFile(path, []byte(content), mode)
|
||||
}
|
||||
|
||||
var origVendor string
|
||||
|
||||
BeforeSuite(func() {
|
||||
origVendor = os.Getenv("GO15VENDOREXPERIMENT")
|
||||
})
|
||||
|
||||
AfterSuite(func() {
|
||||
os.Setenv("GO15VENDOREXPERIMENT", origVendor)
|
||||
})
|
||||
|
||||
BeforeEach(func() {
|
||||
var err error
|
||||
tmpDir, err = ioutil.TempDir("/tmp", "ginkgo")
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
|
||||
cwd, err := os.Getwd()
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
relTmpDir, err = filepath.Rel(cwd, tmpDir)
|
||||
relTmpDir = "./" + relTmpDir
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
|
||||
//go files in the root directory (no tests)
|
||||
writeFile("/", "main.go", "package main", 0666)
|
||||
|
||||
//non-go files in a nested directory
|
||||
writeFile("/redherring", "big_test.jpg", "package ginkgo", 0666)
|
||||
|
||||
//non-ginkgo tests in a nested directory
|
||||
writeFile("/professorplum", "professorplum_test.go", `import "testing"`, 0666)
|
||||
|
||||
//ginkgo tests in a nested directory
|
||||
writeFile("/colonelmustard", "colonelmustard_test.go", `import "github.com/onsi/ginkgo"`, 0666)
|
||||
|
||||
//ginkgo tests in a deeply nested directory
|
||||
writeFile("/colonelmustard/library", "library_test.go", `import "github.com/onsi/ginkgo"`, 0666)
|
||||
|
||||
//ginkgo tests deeply nested in a vendored dependency
|
||||
writeFile("/vendor/mrspeacock/lounge", "lounge_test.go", `import "github.com/onsi/ginkgo"`, 0666)
|
||||
|
||||
//a precompiled ginkgo test
|
||||
writeFile("/precompiled-dir", "precompiled.test", `fake-binary-file`, 0777)
|
||||
writeFile("/precompiled-dir", "some-other-binary", `fake-binary-file`, 0777)
|
||||
writeFile("/precompiled-dir", "nonexecutable.test", `fake-binary-file`, 0666)
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
os.RemoveAll(tmpDir)
|
||||
})
|
||||
|
||||
Describe("Finding precompiled test suites", func() {
|
||||
Context("if pointed at an executable file that ends with .test", func() {
|
||||
It("should return a precompiled test suite", func() {
|
||||
suite, err := PrecompiledTestSuite(filepath.Join(tmpDir, "precompiled-dir", "precompiled.test"))
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
Ω(suite).Should(Equal(TestSuite{
|
||||
Path: relTmpDir + "/precompiled-dir",
|
||||
PackageName: "precompiled",
|
||||
IsGinkgo: true,
|
||||
Precompiled: true,
|
||||
}))
|
||||
})
|
||||
})
|
||||
|
||||
Context("if pointed at a directory", func() {
|
||||
It("should error", func() {
|
||||
suite, err := PrecompiledTestSuite(filepath.Join(tmpDir, "precompiled-dir"))
|
||||
Ω(suite).Should(BeZero())
|
||||
Ω(err).Should(HaveOccurred())
|
||||
})
|
||||
})
|
||||
|
||||
Context("if pointed at an executable that doesn't have .test", func() {
|
||||
It("should error", func() {
|
||||
suite, err := PrecompiledTestSuite(filepath.Join(tmpDir, "precompiled-dir", "some-other-binary"))
|
||||
Ω(suite).Should(BeZero())
|
||||
Ω(err).Should(HaveOccurred())
|
||||
})
|
||||
})
|
||||
|
||||
Context("if pointed at a .test that isn't executable", func() {
|
||||
It("should error", func() {
|
||||
suite, err := PrecompiledTestSuite(filepath.Join(tmpDir, "precompiled-dir", "nonexecutable.test"))
|
||||
Ω(suite).Should(BeZero())
|
||||
Ω(err).Should(HaveOccurred())
|
||||
})
|
||||
})
|
||||
|
||||
Context("if pointed at a nonexisting file", func() {
|
||||
It("should error", func() {
|
||||
suite, err := PrecompiledTestSuite(filepath.Join(tmpDir, "precompiled-dir", "nope-nothing-to-see-here"))
|
||||
Ω(suite).Should(BeZero())
|
||||
Ω(err).Should(HaveOccurred())
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Describe("scanning for suites in a directory", func() {
|
||||
Context("when there are no tests in the specified directory", func() {
|
||||
It("should come up empty", func() {
|
||||
suites := SuitesInDir(tmpDir, false)
|
||||
Ω(suites).Should(BeEmpty())
|
||||
})
|
||||
})
|
||||
|
||||
Context("when there are ginkgo tests in the specified directory", func() {
|
||||
It("should return an appropriately configured suite", func() {
|
||||
suites := SuitesInDir(filepath.Join(tmpDir, "colonelmustard"), false)
|
||||
Ω(suites).Should(HaveLen(1))
|
||||
|
||||
Ω(suites[0].Path).Should(Equal(relTmpDir + "/colonelmustard"))
|
||||
Ω(suites[0].PackageName).Should(Equal("colonelmustard"))
|
||||
Ω(suites[0].IsGinkgo).Should(BeTrue())
|
||||
Ω(suites[0].Precompiled).Should(BeFalse())
|
||||
})
|
||||
})
|
||||
|
||||
Context("when there are non-ginkgo tests in the specified directory", func() {
|
||||
It("should return an appropriately configured suite", func() {
|
||||
suites := SuitesInDir(filepath.Join(tmpDir, "professorplum"), false)
|
||||
Ω(suites).Should(HaveLen(1))
|
||||
|
||||
Ω(suites[0].Path).Should(Equal(relTmpDir + "/professorplum"))
|
||||
Ω(suites[0].PackageName).Should(Equal("professorplum"))
|
||||
Ω(suites[0].IsGinkgo).Should(BeFalse())
|
||||
Ω(suites[0].Precompiled).Should(BeFalse())
|
||||
})
|
||||
})
|
||||
|
||||
Context("given GO15VENDOREXPERIMENT", func() {
|
||||
BeforeEach(func() {
|
||||
os.Setenv("GO15VENDOREXPERIMENT", "1")
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
os.Setenv("GO15VENDOREXPERIMENT", "")
|
||||
})
|
||||
|
||||
It("should skip vendor dirs", func() {
|
||||
suites := SuitesInDir(filepath.Join(tmpDir+"/vendor"), false)
|
||||
Ω(suites).Should(HaveLen(0))
|
||||
})
|
||||
|
||||
It("should not recurse into vendor dirs", func() {
|
||||
suites := SuitesInDir(filepath.Join(tmpDir), true)
|
||||
Ω(suites).Should(HaveLen(3))
|
||||
})
|
||||
})
|
||||
|
||||
Context("when recursively scanning", func() {
|
||||
It("should return suites for corresponding test suites, only", func() {
|
||||
suites := SuitesInDir(tmpDir, true)
|
||||
Ω(suites).Should(HaveLen(4))
|
||||
|
||||
Ω(suites).Should(ContainElement(TestSuite{
|
||||
Path: relTmpDir + "/colonelmustard",
|
||||
PackageName: "colonelmustard",
|
||||
IsGinkgo: true,
|
||||
Precompiled: false,
|
||||
}))
|
||||
Ω(suites).Should(ContainElement(TestSuite{
|
||||
Path: relTmpDir + "/professorplum",
|
||||
PackageName: "professorplum",
|
||||
IsGinkgo: false,
|
||||
Precompiled: false,
|
||||
}))
|
||||
Ω(suites).Should(ContainElement(TestSuite{
|
||||
Path: relTmpDir + "/colonelmustard/library",
|
||||
PackageName: "library",
|
||||
IsGinkgo: true,
|
||||
Precompiled: false,
|
||||
}))
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
16
vendor/github.com/onsi/ginkgo/ginkgo/testsuite/vendor_check_go15.go
generated
vendored
Normal file
16
vendor/github.com/onsi/ginkgo/ginkgo/testsuite/vendor_check_go15.go
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
// +build !go1.6
|
||||
|
||||
package testsuite
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
)
|
||||
|
||||
// "This change will only be enabled if the go command is run with
|
||||
// GO15VENDOREXPERIMENT=1 in its environment."
|
||||
// c.f. the vendor-experiment proposal https://goo.gl/2ucMeC
|
||||
func vendorExperimentCheck(dir string) bool {
|
||||
vendorExperiment := os.Getenv("GO15VENDOREXPERIMENT")
|
||||
return vendorExperiment == "1" && path.Base(dir) == "vendor"
|
||||
}
|
||||
15
vendor/github.com/onsi/ginkgo/ginkgo/testsuite/vendor_check_go16.go
generated
vendored
Normal file
15
vendor/github.com/onsi/ginkgo/ginkgo/testsuite/vendor_check_go16.go
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
// +build go1.6
|
||||
|
||||
package testsuite
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
)
|
||||
|
||||
// in 1.6 the vendor directory became the default go behaviour, so now
|
||||
// check if its disabled.
|
||||
func vendorExperimentCheck(dir string) bool {
|
||||
vendorExperiment := os.Getenv("GO15VENDOREXPERIMENT")
|
||||
return vendorExperiment != "0" && path.Base(dir) == "vendor"
|
||||
}
|
||||
20
vendor/github.com/onsi/ginkgo/ginkgo/watch_command.go
generated
vendored
20
vendor/github.com/onsi/ginkgo/ginkgo/watch_command.go
generated
vendored
@@ -10,6 +10,7 @@ import (
|
||||
"github.com/onsi/ginkgo/ginkgo/testrunner"
|
||||
"github.com/onsi/ginkgo/ginkgo/testsuite"
|
||||
"github.com/onsi/ginkgo/ginkgo/watch"
|
||||
colorable "github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable"
|
||||
)
|
||||
|
||||
func BuildWatchCommand() *Command {
|
||||
@@ -57,7 +58,7 @@ func (w *SpecWatcher) runnersForSuites(suites []testsuite.TestSuite, additionalA
|
||||
runners := []*testrunner.TestRunner{}
|
||||
|
||||
for _, suite := range suites {
|
||||
runners = append(runners, testrunner.New(suite, w.commandFlags.NumCPU, w.commandFlags.ParallelStream, w.commandFlags.Race, w.commandFlags.Cover, w.commandFlags.CoverPkg, w.commandFlags.Tags, additionalArgs))
|
||||
runners = append(runners, testrunner.New(suite, w.commandFlags.NumCPU, w.commandFlags.ParallelStream, w.commandFlags.GoOpts, additionalArgs))
|
||||
}
|
||||
|
||||
return runners
|
||||
@@ -96,29 +97,30 @@ func (w *SpecWatcher) WatchSuites(args []string, additionalArgs []string) {
|
||||
case <-ticker.C:
|
||||
suites, _ := findSuites(args, w.commandFlags.Recurse, w.commandFlags.SkipPackage, false)
|
||||
delta, _ := deltaTracker.Delta(suites)
|
||||
coloredStream := colorable.NewColorableStdout()
|
||||
|
||||
suitesToRun := []testsuite.TestSuite{}
|
||||
|
||||
if len(delta.NewSuites) > 0 {
|
||||
fmt.Printf(greenColor+"Detected %d new %s:\n"+defaultStyle, len(delta.NewSuites), pluralizedWord("suite", "suites", len(delta.NewSuites)))
|
||||
fmt.Fprintf(coloredStream, greenColor+"Detected %d new %s:\n"+defaultStyle, len(delta.NewSuites), pluralizedWord("suite", "suites", len(delta.NewSuites)))
|
||||
for _, suite := range delta.NewSuites {
|
||||
suitesToRun = append(suitesToRun, suite.Suite)
|
||||
fmt.Println(" " + suite.Description())
|
||||
fmt.Fprintln(coloredStream, " "+suite.Description())
|
||||
}
|
||||
}
|
||||
|
||||
modifiedSuites := delta.ModifiedSuites()
|
||||
if len(modifiedSuites) > 0 {
|
||||
fmt.Println(greenColor + "\nDetected changes in:" + defaultStyle)
|
||||
fmt.Fprintln(coloredStream, greenColor+"\nDetected changes in:"+defaultStyle)
|
||||
for _, pkg := range delta.ModifiedPackages {
|
||||
fmt.Println(" " + pkg)
|
||||
fmt.Fprintln(coloredStream, " "+pkg)
|
||||
}
|
||||
fmt.Printf(greenColor+"Will run %d %s:\n"+defaultStyle, len(modifiedSuites), pluralizedWord("suite", "suites", len(modifiedSuites)))
|
||||
fmt.Fprintf(coloredStream, greenColor+"Will run %d %s:\n"+defaultStyle, len(modifiedSuites), pluralizedWord("suite", "suites", len(modifiedSuites)))
|
||||
for _, suite := range modifiedSuites {
|
||||
suitesToRun = append(suitesToRun, suite.Suite)
|
||||
fmt.Println(" " + suite.Description())
|
||||
fmt.Fprintln(coloredStream, " "+suite.Description())
|
||||
}
|
||||
fmt.Println("")
|
||||
fmt.Fprintln(coloredStream, "")
|
||||
}
|
||||
|
||||
if len(suitesToRun) > 0 {
|
||||
@@ -136,7 +138,7 @@ func (w *SpecWatcher) WatchSuites(args []string, additionalArgs []string) {
|
||||
if result.Passed {
|
||||
color = greenColor
|
||||
}
|
||||
fmt.Println(color + "\nDone. Resuming watch..." + defaultStyle)
|
||||
fmt.Fprintln(coloredStream, color+"\nDone. Resuming watch..."+defaultStyle)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
13
vendor/github.com/onsi/ginkgo/ginkgo_dsl.go
generated
vendored
13
vendor/github.com/onsi/ginkgo/ginkgo_dsl.go
generated
vendored
@@ -68,6 +68,14 @@ type GinkgoTestingT interface {
|
||||
Fail()
|
||||
}
|
||||
|
||||
//GinkgoRandomSeed returns the seed used to randomize spec execution order. It is
|
||||
//useful for seeding your own pseudorandom number generators (PRNGs) to ensure
|
||||
//consistent executions from run to run, where your tests contain variability (for
|
||||
//example, when selecting random test data).
|
||||
func GinkgoRandomSeed() int64 {
|
||||
return config.GinkgoConfig.RandomSeed
|
||||
}
|
||||
|
||||
//GinkgoParallelNode returns the parallel node number for the current ginkgo process
|
||||
//The node number is 1-indexed
|
||||
func GinkgoParallelNode() int {
|
||||
@@ -168,6 +176,8 @@ func CurrentGinkgoTestDescription() GinkgoTestDescription {
|
||||
//
|
||||
//You use the Time() function to time how long the passed in body function takes to run
|
||||
//You use the RecordValue() function to track arbitrary numerical measurements.
|
||||
//The RecordValueWithPrecision() function can be used alternatively to provide the unit
|
||||
//and resolution of the numeric measurement.
|
||||
//The optional info argument is passed to the test reporter and can be used to
|
||||
// provide the measurement data to a custom reporter with context.
|
||||
//
|
||||
@@ -175,6 +185,7 @@ func CurrentGinkgoTestDescription() GinkgoTestDescription {
|
||||
type Benchmarker interface {
|
||||
Time(name string, body func(), info ...interface{}) (elapsedTime time.Duration)
|
||||
RecordValue(name string, value float64, info ...interface{})
|
||||
RecordValueWithPrecision(name string, value float64, units string, precision int, info ...interface{})
|
||||
}
|
||||
|
||||
//RunSpecs is the entry point for the Ginkgo test runner.
|
||||
@@ -215,7 +226,7 @@ func RunSpecsWithCustomReporters(t GinkgoTestingT, description string, specRepor
|
||||
func buildDefaultReporter() Reporter {
|
||||
remoteReportingServer := config.GinkgoConfig.StreamHost
|
||||
if remoteReportingServer == "" {
|
||||
stenographer := stenographer.New(!config.DefaultReporterConfig.NoColor)
|
||||
stenographer := stenographer.New(!config.DefaultReporterConfig.NoColor, config.GinkgoConfig.FlakeAttempts > 1)
|
||||
return reporters.NewDefaultReporter(config.DefaultReporterConfig, stenographer)
|
||||
} else {
|
||||
return remote.NewForwardingReporter(remoteReportingServer, &http.Client{}, remote.NewOutputInterceptor())
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package tmp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSomethingLessImportant(t *testing.T) {
|
||||
strp := "hello!"
|
||||
somethingImportant(t, &strp)
|
||||
}
|
||||
|
||||
func somethingImportant(t *testing.T, message *string) {
|
||||
t.Log("Something important happened in a test: " + *message)
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package nested
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSomethingLessImportant(t *testing.T) {
|
||||
whatever := &UselessStruct{}
|
||||
t.Fail(whatever.ImportantField != "SECRET_PASSWORD")
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package subpackage
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNestedSubPackages(t *testing.T) {
|
||||
t.Fail(true)
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package tmp_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
type UselessStruct struct {
|
||||
ImportantField string
|
||||
}
|
||||
|
||||
func TestSomethingImportant(t *testing.T) {
|
||||
whatever := &UselessStruct{}
|
||||
if whatever.ImportantField != "SECRET_PASSWORD" {
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
41
vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_fixtures/xunit_test.go
generated
vendored
41
vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_fixtures/xunit_test.go
generated
vendored
@@ -1,41 +0,0 @@
|
||||
package tmp
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
type UselessStruct struct {
|
||||
ImportantField string
|
||||
T *testing.T
|
||||
}
|
||||
|
||||
var testFunc = func(t *testing.T, arg *string) {}
|
||||
|
||||
func assertEqual(t *testing.T, arg1, arg2 interface{}) {
|
||||
if arg1 != arg2 {
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
|
||||
func TestSomethingImportant(t *testing.T) {
|
||||
whatever := &UselessStruct{
|
||||
T: t,
|
||||
ImportantField: "SECRET_PASSWORD",
|
||||
}
|
||||
something := &UselessStruct{ImportantField: "string value"}
|
||||
assertEqual(t, whatever.ImportantField, "SECRET_PASSWORD")
|
||||
assertEqual(t, something.ImportantField, "string value")
|
||||
|
||||
var foo = func(t *testing.T) {}
|
||||
foo(t)
|
||||
|
||||
strp := "something"
|
||||
testFunc(t, &strp)
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
func Test3Things(t *testing.T) {
|
||||
if 3 != 3 {
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package tmp
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
)
|
||||
|
||||
var _ = Describe("Testing with Ginkgo", func() {
|
||||
It("something less important", func() {
|
||||
|
||||
strp := "hello!"
|
||||
somethingImportant(GinkgoT(), &strp)
|
||||
})
|
||||
})
|
||||
|
||||
func somethingImportant(t GinkgoTInterface, message *string) {
|
||||
t.Log("Something important happened in a test: " + *message)
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package tmp
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTmp(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "Tmp Suite")
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package subpackage
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
)
|
||||
|
||||
var _ = Describe("Testing with Ginkgo", func() {
|
||||
It("nested sub packages", func() {
|
||||
GinkgoT().Fail(true)
|
||||
})
|
||||
})
|
||||
@@ -1,13 +0,0 @@
|
||||
package nested_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestNested(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "Nested Suite")
|
||||
}
|
||||
13
vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/nested_test.go
generated
vendored
13
vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/nested_test.go
generated
vendored
@@ -1,13 +0,0 @@
|
||||
package nested
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
)
|
||||
|
||||
var _ = Describe("Testing with Ginkgo", func() {
|
||||
It("something less important", func() {
|
||||
|
||||
whatever := &UselessStruct{}
|
||||
GinkgoT().Fail(whatever.ImportantField != "SECRET_PASSWORD")
|
||||
})
|
||||
})
|
||||
@@ -1,19 +0,0 @@
|
||||
package tmp_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
)
|
||||
|
||||
var _ = Describe("Testing with Ginkgo", func() {
|
||||
It("something important", func() {
|
||||
|
||||
whatever := &UselessStruct{}
|
||||
if whatever.ImportantField != "SECRET_PASSWORD" {
|
||||
GinkgoT().Fail()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
type UselessStruct struct {
|
||||
ImportantField string
|
||||
}
|
||||
13
vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/suite_test.go
generated
vendored
13
vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/suite_test.go
generated
vendored
@@ -1,13 +0,0 @@
|
||||
package tmp_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestConvertFixtures(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "ConvertFixtures Suite")
|
||||
}
|
||||
44
vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/xunit_test.go
generated
vendored
44
vendor/github.com/onsi/ginkgo/integration/_fixtures/convert_goldmasters/xunit_test.go
generated
vendored
@@ -1,44 +0,0 @@
|
||||
package tmp
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
)
|
||||
|
||||
var _ = Describe("Testing with Ginkgo", func() {
|
||||
It("something important", func() {
|
||||
|
||||
whatever := &UselessStruct{
|
||||
T: GinkgoT(),
|
||||
ImportantField: "SECRET_PASSWORD",
|
||||
}
|
||||
something := &UselessStruct{ImportantField: "string value"}
|
||||
assertEqual(GinkgoT(), whatever.ImportantField, "SECRET_PASSWORD")
|
||||
assertEqual(GinkgoT(), something.ImportantField, "string value")
|
||||
|
||||
var foo = func(t GinkgoTInterface) {}
|
||||
foo(GinkgoT())
|
||||
|
||||
strp := "something"
|
||||
testFunc(GinkgoT(), &strp)
|
||||
GinkgoT().Fail()
|
||||
})
|
||||
It("3 things", func() {
|
||||
|
||||
if 3 != 3 {
|
||||
GinkgoT().Fail()
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
type UselessStruct struct {
|
||||
ImportantField string
|
||||
T GinkgoTInterface
|
||||
}
|
||||
|
||||
var testFunc = func(t GinkgoTInterface, arg *string) {}
|
||||
|
||||
func assertEqual(t GinkgoTInterface, arg1, arg2 interface{}) {
|
||||
if arg1 != arg2 {
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
21
vendor/github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture/coverage.go
generated
vendored
21
vendor/github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture/coverage.go
generated
vendored
@@ -1,21 +0,0 @@
|
||||
package coverage_fixture
|
||||
|
||||
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"
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package coverage_fixture_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCoverageFixture(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "CoverageFixture Suite")
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
package coverage_fixture_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture"
|
||||
. "github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture/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"))
|
||||
})
|
||||
})
|
||||
@@ -1,9 +0,0 @@
|
||||
package external_coverage
|
||||
|
||||
func Tested() string {
|
||||
return "tested"
|
||||
}
|
||||
|
||||
func Untested() string {
|
||||
return "untested"
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package does_not_compile_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDoes_not_compile(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "Does_not_compile Suite")
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
package does_not_compile_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/ginkgo/integration/_fixtures/does_not_compile"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("DoesNotCompile", func() {
|
||||
|
||||
})
|
||||
@@ -1,13 +0,0 @@
|
||||
package eventually_failing_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestEventuallyFailing(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "EventuallyFailing Suite")
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package eventually_failing_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("EventuallyFailing", func() {
|
||||
It("should fail on the third try", func() {
|
||||
time.Sleep(time.Second)
|
||||
files, err := ioutil.ReadDir(".")
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
|
||||
numRuns := 1
|
||||
for _, file := range files {
|
||||
if strings.HasPrefix(file.Name(), "counter") {
|
||||
numRuns++
|
||||
}
|
||||
}
|
||||
|
||||
Ω(numRuns).Should(BeNumerically("<", 3))
|
||||
ioutil.WriteFile(fmt.Sprintf("./counter-%d", numRuns), []byte("foo"), 0777)
|
||||
})
|
||||
})
|
||||
@@ -1,35 +0,0 @@
|
||||
package synchronized_setup_tests_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSynchronized_setup_tests(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "Synchronized_setup_tests Suite")
|
||||
}
|
||||
|
||||
var beforeData string
|
||||
|
||||
var _ = SynchronizedBeforeSuite(func() []byte {
|
||||
fmt.Printf("BEFORE_A_%d\n", GinkgoParallelNode())
|
||||
os.Exit(1)
|
||||
return []byte("WHAT EVZ")
|
||||
}, func(data []byte) {
|
||||
println("NEVER SEE THIS")
|
||||
})
|
||||
|
||||
var _ = Describe("Synchronized Setup", func() {
|
||||
It("should do nothing", func() {
|
||||
Ω(true).Should(BeTrue())
|
||||
})
|
||||
|
||||
It("should do nothing", func() {
|
||||
Ω(true).Should(BeTrue())
|
||||
})
|
||||
})
|
||||
@@ -1,13 +0,0 @@
|
||||
package fail_fixture_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFail_fixture(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "Fail_fixture Suite")
|
||||
}
|
||||
99
vendor/github.com/onsi/ginkgo/integration/_fixtures/fail_fixture/fail_fixture_test.go
generated
vendored
99
vendor/github.com/onsi/ginkgo/integration/_fixtures/fail_fixture/fail_fixture_test.go
generated
vendored
@@ -1,99 +0,0 @@
|
||||
package fail_fixture_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = It("handles top level failures", func() {
|
||||
Ω("a top level failure on line 9").Should(Equal("nope"))
|
||||
println("NEVER SEE THIS")
|
||||
})
|
||||
|
||||
var _ = It("handles async top level failures", func(done Done) {
|
||||
Fail("an async top level failure on line 14")
|
||||
println("NEVER SEE THIS")
|
||||
}, 0.1)
|
||||
|
||||
var _ = It("FAIL in a goroutine", func(done Done) {
|
||||
go func() {
|
||||
defer GinkgoRecover()
|
||||
Fail("a top level goroutine failure on line 21")
|
||||
println("NEVER SEE THIS")
|
||||
}()
|
||||
}, 0.1)
|
||||
|
||||
var _ = Describe("Excercising different failure modes", func() {
|
||||
It("synchronous failures", func() {
|
||||
Ω("a sync failure").Should(Equal("nope"))
|
||||
println("NEVER SEE THIS")
|
||||
})
|
||||
|
||||
It("synchronous panics", func() {
|
||||
panic("a sync panic")
|
||||
println("NEVER SEE THIS")
|
||||
})
|
||||
|
||||
It("synchronous failures with FAIL", func() {
|
||||
Fail("a sync FAIL failure")
|
||||
println("NEVER SEE THIS")
|
||||
})
|
||||
|
||||
It("async timeout", func(done Done) {
|
||||
Ω(true).Should(BeTrue())
|
||||
}, 0.1)
|
||||
|
||||
It("async failure", func(done Done) {
|
||||
Ω("an async failure").Should(Equal("nope"))
|
||||
println("NEVER SEE THIS")
|
||||
}, 0.1)
|
||||
|
||||
It("async panic", func(done Done) {
|
||||
panic("an async panic")
|
||||
println("NEVER SEE THIS")
|
||||
}, 0.1)
|
||||
|
||||
It("async failure with FAIL", func(done Done) {
|
||||
Fail("an async FAIL failure")
|
||||
println("NEVER SEE THIS")
|
||||
}, 0.1)
|
||||
|
||||
It("FAIL in a goroutine", func(done Done) {
|
||||
go func() {
|
||||
defer GinkgoRecover()
|
||||
Fail("a goroutine FAIL failure")
|
||||
println("NEVER SEE THIS")
|
||||
}()
|
||||
}, 0.1)
|
||||
|
||||
It("Gomega in a goroutine", func(done Done) {
|
||||
go func() {
|
||||
defer GinkgoRecover()
|
||||
Ω("a goroutine failure").Should(Equal("nope"))
|
||||
println("NEVER SEE THIS")
|
||||
}()
|
||||
}, 0.1)
|
||||
|
||||
It("Panic in a goroutine", func(done Done) {
|
||||
go func() {
|
||||
defer GinkgoRecover()
|
||||
panic("a goroutine panic")
|
||||
println("NEVER SEE THIS")
|
||||
}()
|
||||
}, 0.1)
|
||||
|
||||
Measure("a FAIL measure", func(Benchmarker) {
|
||||
Fail("a measure FAIL failure")
|
||||
println("NEVER SEE THIS")
|
||||
}, 1)
|
||||
|
||||
Measure("a gomega failed measure", func(Benchmarker) {
|
||||
Ω("a measure failure").Should(Equal("nope"))
|
||||
println("NEVER SEE THIS")
|
||||
}, 1)
|
||||
|
||||
Measure("a panicking measure", func(Benchmarker) {
|
||||
panic("a measure panic")
|
||||
println("NEVER SEE THIS")
|
||||
}, 1)
|
||||
})
|
||||
@@ -1,22 +0,0 @@
|
||||
package failing_before_suite_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFailingAfterSuite(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "FailingAfterSuite Suite")
|
||||
}
|
||||
|
||||
var _ = BeforeSuite(func() {
|
||||
println("BEFORE SUITE")
|
||||
})
|
||||
|
||||
var _ = AfterSuite(func() {
|
||||
println("AFTER SUITE")
|
||||
panic("BAM!")
|
||||
})
|
||||
@@ -1,15 +0,0 @@
|
||||
package failing_before_suite_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
)
|
||||
|
||||
var _ = Describe("FailingBeforeSuite", func() {
|
||||
It("should run", func() {
|
||||
println("A TEST")
|
||||
})
|
||||
|
||||
It("should run", func() {
|
||||
println("A TEST")
|
||||
})
|
||||
})
|
||||
@@ -1,22 +0,0 @@
|
||||
package failing_before_suite_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFailing_before_suite(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "Failing_before_suite Suite")
|
||||
}
|
||||
|
||||
var _ = BeforeSuite(func() {
|
||||
println("BEFORE SUITE")
|
||||
panic("BAM!")
|
||||
})
|
||||
|
||||
var _ = AfterSuite(func() {
|
||||
println("AFTER SUITE")
|
||||
})
|
||||
@@ -1,15 +0,0 @@
|
||||
package failing_before_suite_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
)
|
||||
|
||||
var _ = Describe("FailingBeforeSuite", func() {
|
||||
It("should never run", func() {
|
||||
println("NEVER SEE THIS")
|
||||
})
|
||||
|
||||
It("should never run", func() {
|
||||
println("NEVER SEE THIS")
|
||||
})
|
||||
})
|
||||
@@ -1,5 +0,0 @@
|
||||
package failing_ginkgo_tests
|
||||
|
||||
func AlwaysFalse() bool {
|
||||
return false
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package failing_ginkgo_tests_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFailing_ginkgo_tests(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "Failing_ginkgo_tests Suite")
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package failing_ginkgo_tests_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/ginkgo/integration/_fixtures/failing_ginkgo_tests"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("FailingGinkgoTests", func() {
|
||||
It("should fail", func() {
|
||||
Ω(AlwaysFalse()).Should(BeTrue())
|
||||
})
|
||||
|
||||
It("should pass", func() {
|
||||
Ω(AlwaysFalse()).Should(BeFalse())
|
||||
})
|
||||
})
|
||||
9
vendor/github.com/onsi/ginkgo/integration/_fixtures/flags_tests/flags.go
generated
vendored
9
vendor/github.com/onsi/ginkgo/integration/_fixtures/flags_tests/flags.go
generated
vendored
@@ -1,9 +0,0 @@
|
||||
package flags
|
||||
|
||||
func Tested() string {
|
||||
return "tested"
|
||||
}
|
||||
|
||||
func Untested() string {
|
||||
return "untested"
|
||||
}
|
||||
13
vendor/github.com/onsi/ginkgo/integration/_fixtures/flags_tests/flags_suite_test.go
generated
vendored
13
vendor/github.com/onsi/ginkgo/integration/_fixtures/flags_tests/flags_suite_test.go
generated
vendored
@@ -1,13 +0,0 @@
|
||||
package flags_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFlags(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "Flags Suite")
|
||||
}
|
||||
82
vendor/github.com/onsi/ginkgo/integration/_fixtures/flags_tests/flags_test.go
generated
vendored
82
vendor/github.com/onsi/ginkgo/integration/_fixtures/flags_tests/flags_test.go
generated
vendored
@@ -1,82 +0,0 @@
|
||||
package flags_test
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/ginkgo/integration/_fixtures/flags_tests"
|
||||
. "github.com/onsi/gomega"
|
||||
"time"
|
||||
)
|
||||
|
||||
var customFlag string
|
||||
|
||||
func init() {
|
||||
flag.StringVar(&customFlag, "customFlag", "default", "custom flag!")
|
||||
}
|
||||
|
||||
var _ = Describe("Testing various flags", func() {
|
||||
FDescribe("the focused set", func() {
|
||||
Measure("a measurement", func(b Benchmarker) {
|
||||
b.RecordValue("a value", 3)
|
||||
}, 3)
|
||||
|
||||
It("should honor -cover", func() {
|
||||
Ω(Tested()).Should(Equal("tested"))
|
||||
})
|
||||
|
||||
PIt("should honor -failOnPending and -noisyPendings")
|
||||
|
||||
Describe("smores", func() {
|
||||
It("should honor -skip: marshmallow", func() {
|
||||
println("marshmallow")
|
||||
})
|
||||
|
||||
It("should honor -focus: chocolate", func() {
|
||||
println("chocolate")
|
||||
})
|
||||
})
|
||||
|
||||
It("should detect races", func(done Done) {
|
||||
var a string
|
||||
go func() {
|
||||
a = "now you don't"
|
||||
close(done)
|
||||
}()
|
||||
a = "now you see me"
|
||||
println(a)
|
||||
})
|
||||
|
||||
It("should randomize A", func() {
|
||||
println("RANDOM_A")
|
||||
})
|
||||
|
||||
It("should randomize B", func() {
|
||||
println("RANDOM_B")
|
||||
})
|
||||
|
||||
It("should randomize C", func() {
|
||||
println("RANDOM_C")
|
||||
})
|
||||
|
||||
It("should honor -slowSpecThreshold", func() {
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
})
|
||||
|
||||
It("should pass in additional arguments after '--' directly to the test process", func() {
|
||||
fmt.Printf("CUSTOM_FLAG: %s", customFlag)
|
||||
})
|
||||
})
|
||||
|
||||
Describe("more smores", func() {
|
||||
It("should not run these unless -focus is set", func() {
|
||||
println("smores")
|
||||
})
|
||||
})
|
||||
|
||||
Describe("a failing test", func() {
|
||||
It("should fail", func() {
|
||||
Ω(true).Should(Equal(false))
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -1,13 +0,0 @@
|
||||
package focused_fixture_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFocused_fixture(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "Focused_fixture Suite")
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package focused_fixture_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/ginkgo/extensions/table"
|
||||
)
|
||||
|
||||
var _ = Describe("FocusedFixture", func() {
|
||||
FDescribe("focused", func() {
|
||||
It("focused", func() {
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
FContext("focused", func() {
|
||||
It("focused", func() {
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
FIt("focused", func() {
|
||||
|
||||
})
|
||||
|
||||
FMeasure("focused", func(b Benchmarker) {
|
||||
|
||||
}, 2)
|
||||
|
||||
FDescribeTable("focused",
|
||||
func() {},
|
||||
Entry("focused"),
|
||||
)
|
||||
|
||||
DescribeTable("focused",
|
||||
func() {},
|
||||
FEntry("focused"),
|
||||
)
|
||||
|
||||
Describe("not focused", func() {
|
||||
It("not focused", func() {
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
Context("not focused", func() {
|
||||
It("not focused", func() {
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
It("not focused", func() {
|
||||
|
||||
})
|
||||
|
||||
Measure("not focused", func(b Benchmarker) {
|
||||
|
||||
}, 2)
|
||||
|
||||
DescribeTable("not focused",
|
||||
func() {},
|
||||
Entry("not focused"),
|
||||
)
|
||||
})
|
||||
@@ -1,13 +0,0 @@
|
||||
package hanging_suite_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestHangingSuite(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "HangingSuite Suite")
|
||||
}
|
||||
30
vendor/github.com/onsi/ginkgo/integration/_fixtures/hanging_suite/hanging_suite_test.go
generated
vendored
30
vendor/github.com/onsi/ginkgo/integration/_fixtures/hanging_suite/hanging_suite_test.go
generated
vendored
@@ -1,30 +0,0 @@
|
||||
package hanging_suite_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
)
|
||||
|
||||
var _ = AfterSuite(func() {
|
||||
fmt.Println("Heading Out After Suite")
|
||||
})
|
||||
|
||||
var _ = Describe("HangingSuite", func() {
|
||||
BeforeEach(func() {
|
||||
fmt.Fprintln(GinkgoWriter, "Just beginning")
|
||||
})
|
||||
|
||||
Context("inner context", func() {
|
||||
BeforeEach(func() {
|
||||
fmt.Fprintln(GinkgoWriter, "Almost there...")
|
||||
})
|
||||
|
||||
It("should hang out for a while", func() {
|
||||
fmt.Fprintln(GinkgoWriter, "Hanging Out")
|
||||
fmt.Println("Sleeping...")
|
||||
time.Sleep(time.Hour)
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -1,5 +0,0 @@
|
||||
package more_ginkgo_tests
|
||||
|
||||
func AlwaysTrue() bool {
|
||||
return true
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package more_ginkgo_tests_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestMore_ginkgo_tests(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "More_ginkgo_tests Suite")
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
package more_ginkgo_tests_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/ginkgo/integration/_fixtures/more_ginkgo_tests"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("MoreGinkgoTests", func() {
|
||||
It("should pass", func() {
|
||||
Ω(AlwaysTrue()).Should(BeTrue())
|
||||
})
|
||||
|
||||
It("should always pass", func() {
|
||||
Ω(AlwaysTrue()).Should(BeTrue())
|
||||
})
|
||||
})
|
||||
4
vendor/github.com/onsi/ginkgo/integration/_fixtures/no_tests/no_tests.go
generated
vendored
4
vendor/github.com/onsi/ginkgo/integration/_fixtures/no_tests/no_tests.go
generated
vendored
@@ -1,4 +0,0 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package passing_ginkgo_tests
|
||||
|
||||
func StringIdentity(a string) string {
|
||||
return a
|
||||
}
|
||||
|
||||
func IntegerIdentity(a int) int {
|
||||
return a
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package passing_ginkgo_tests_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPassing_ginkgo_tests(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "Passing_ginkgo_tests Suite")
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package passing_ginkgo_tests_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/ginkgo/integration/_fixtures/passing_ginkgo_tests"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("PassingGinkgoTests", func() {
|
||||
It("should proxy strings", func() {
|
||||
Ω(StringIdentity("foo")).Should(Equal("foo"))
|
||||
})
|
||||
|
||||
It("should proxy integers", func() {
|
||||
Ω(IntegerIdentity(3)).Should(Equal(3))
|
||||
})
|
||||
|
||||
It("should do it again", func() {
|
||||
Ω(StringIdentity("foo")).Should(Equal("foo"))
|
||||
Ω(IntegerIdentity(3)).Should(Equal(3))
|
||||
})
|
||||
|
||||
It("should be able to run Bys", func() {
|
||||
By("emitting one By")
|
||||
Ω(3).Should(Equal(3))
|
||||
|
||||
By("emitting another By")
|
||||
Ω(4).Should(Equal(4))
|
||||
})
|
||||
})
|
||||
@@ -1,26 +0,0 @@
|
||||
package passing_before_suite_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestPassingSuiteSetup(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "PassingSuiteSetup Suite")
|
||||
}
|
||||
|
||||
var a string
|
||||
var b string
|
||||
|
||||
var _ = BeforeSuite(func() {
|
||||
a = "ran before suite"
|
||||
println("BEFORE SUITE")
|
||||
})
|
||||
|
||||
var _ = AfterSuite(func() {
|
||||
b = "ran after suite"
|
||||
println("AFTER SUITE")
|
||||
})
|
||||
@@ -1,28 +0,0 @@
|
||||
package passing_before_suite_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("PassingSuiteSetup", func() {
|
||||
It("should pass", func() {
|
||||
Ω(a).Should(Equal("ran before suite"))
|
||||
Ω(b).Should(BeEmpty())
|
||||
})
|
||||
|
||||
It("should pass", func() {
|
||||
Ω(a).Should(Equal("ran before suite"))
|
||||
Ω(b).Should(BeEmpty())
|
||||
})
|
||||
|
||||
It("should pass", func() {
|
||||
Ω(a).Should(Equal("ran before suite"))
|
||||
Ω(b).Should(BeEmpty())
|
||||
})
|
||||
|
||||
It("should pass", func() {
|
||||
Ω(a).Should(Equal("ran before suite"))
|
||||
Ω(b).Should(BeEmpty())
|
||||
})
|
||||
})
|
||||
@@ -1,13 +0,0 @@
|
||||
package progress_fixture_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestProgressFixture(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "ProgressFixture Suite")
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
package progress_fixture_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
)
|
||||
|
||||
var _ = Describe("ProgressFixture", func() {
|
||||
BeforeEach(func() {
|
||||
fmt.Fprintln(GinkgoWriter, ">outer before<")
|
||||
})
|
||||
|
||||
JustBeforeEach(func() {
|
||||
fmt.Fprintln(GinkgoWriter, ">outer just before<")
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
fmt.Fprintln(GinkgoWriter, ">outer after<")
|
||||
})
|
||||
|
||||
Context("Inner Context", func() {
|
||||
BeforeEach(func() {
|
||||
fmt.Fprintln(GinkgoWriter, ">inner before<")
|
||||
})
|
||||
|
||||
JustBeforeEach(func() {
|
||||
fmt.Fprintln(GinkgoWriter, ">inner just before<")
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
fmt.Fprintln(GinkgoWriter, ">inner after<")
|
||||
})
|
||||
|
||||
It("should emit progress as it goes", func() {
|
||||
fmt.Fprintln(GinkgoWriter, ">it<")
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -1,13 +0,0 @@
|
||||
package fail_fixture_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestFail_fixture(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "Skip_fixture Suite")
|
||||
}
|
||||
71
vendor/github.com/onsi/ginkgo/integration/_fixtures/skip_fixture/skip_fixture_test.go
generated
vendored
71
vendor/github.com/onsi/ginkgo/integration/_fixtures/skip_fixture/skip_fixture_test.go
generated
vendored
@@ -1,71 +0,0 @@
|
||||
package fail_fixture_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = It("handles top level skips", func() {
|
||||
Skip("a top level skip on line 9")
|
||||
println("NEVER SEE THIS")
|
||||
})
|
||||
|
||||
var _ = It("handles async top level skips", func(done Done) {
|
||||
Skip("an async top level skip on line 14")
|
||||
println("NEVER SEE THIS")
|
||||
}, 0.1)
|
||||
|
||||
var _ = It("SKIP in a goroutine", func(done Done) {
|
||||
go func() {
|
||||
defer GinkgoRecover()
|
||||
Skip("a top level goroutine skip on line 21")
|
||||
println("NEVER SEE THIS")
|
||||
}()
|
||||
}, 0.1)
|
||||
|
||||
var _ = Describe("Excercising different skip modes", func() {
|
||||
It("synchronous skip", func() {
|
||||
Skip("a sync SKIP")
|
||||
println("NEVER SEE THIS")
|
||||
})
|
||||
|
||||
It("async skip", func(done Done) {
|
||||
Skip("an async SKIP")
|
||||
println("NEVER SEE THIS")
|
||||
}, 0.1)
|
||||
|
||||
It("SKIP in a goroutine", func(done Done) {
|
||||
go func() {
|
||||
defer GinkgoRecover()
|
||||
Skip("a goroutine SKIP")
|
||||
println("NEVER SEE THIS")
|
||||
}()
|
||||
}, 0.1)
|
||||
|
||||
Measure("a SKIP measure", func(Benchmarker) {
|
||||
Skip("a measure SKIP")
|
||||
println("NEVER SEE THIS")
|
||||
}, 1)
|
||||
})
|
||||
|
||||
var _ = Describe("SKIP in a BeforeEach", func() {
|
||||
BeforeEach(func() {
|
||||
Skip("a BeforeEach SKIP")
|
||||
println("NEVER SEE THIS")
|
||||
})
|
||||
|
||||
It("a SKIP BeforeEach", func() {
|
||||
println("NEVER SEE THIS")
|
||||
})
|
||||
})
|
||||
|
||||
var _ = Describe("SKIP in an AfterEach", func() {
|
||||
AfterEach(func() {
|
||||
Skip("an AfterEach SKIP")
|
||||
println("NEVER SEE THIS")
|
||||
})
|
||||
|
||||
It("a SKIP AfterEach", func() {
|
||||
Expect(true).To(BeTrue())
|
||||
})
|
||||
})
|
||||
@@ -1,9 +0,0 @@
|
||||
package suite_command
|
||||
|
||||
func Tested() string {
|
||||
return "tested"
|
||||
}
|
||||
|
||||
func Untested() string {
|
||||
return "untested"
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
package suite_command_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestSuiteCommand(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "Suite Command Suite")
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package suite_command_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("Testing suite command", func() {
|
||||
It("it should succeed", func() {
|
||||
Ω(true).Should(Equal(true))
|
||||
})
|
||||
|
||||
PIt("a failing test", func() {
|
||||
It("should fail", func() {
|
||||
Ω(true).Should(Equal(false))
|
||||
})
|
||||
})
|
||||
})
|
||||
@@ -1,43 +0,0 @@
|
||||
package synchronized_setup_tests_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"fmt"
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestSynchronized_setup_tests(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "Synchronized_setup_tests Suite")
|
||||
}
|
||||
|
||||
var beforeData string
|
||||
|
||||
var _ = SynchronizedBeforeSuite(func() []byte {
|
||||
fmt.Printf("BEFORE_A_%d\n", GinkgoParallelNode())
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
return []byte("DATA")
|
||||
}, func(data []byte) {
|
||||
fmt.Printf("BEFORE_B_%d: %s\n", GinkgoParallelNode(), string(data))
|
||||
beforeData += string(data) + "OTHER"
|
||||
})
|
||||
|
||||
var _ = SynchronizedAfterSuite(func() {
|
||||
fmt.Printf("\nAFTER_A_%d\n", GinkgoParallelNode())
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}, func() {
|
||||
fmt.Printf("AFTER_B_%d\n", GinkgoParallelNode())
|
||||
})
|
||||
|
||||
var _ = Describe("Synchronized Setup", func() {
|
||||
It("should run the before suite once", func() {
|
||||
Ω(beforeData).Should(Equal("DATAOTHER"))
|
||||
})
|
||||
|
||||
It("should run the before suite once", func() {
|
||||
Ω(beforeData).Should(Equal("DATAOTHER"))
|
||||
})
|
||||
})
|
||||
17
vendor/github.com/onsi/ginkgo/integration/_fixtures/tags_tests/ignored_test.go
generated
vendored
17
vendor/github.com/onsi/ginkgo/integration/_fixtures/tags_tests/ignored_test.go
generated
vendored
@@ -1,17 +0,0 @@
|
||||
// +build complex_tests
|
||||
|
||||
package tags_tests_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
)
|
||||
|
||||
var _ = Describe("Ignored", func() {
|
||||
It("should not have these tests", func() {
|
||||
|
||||
})
|
||||
|
||||
It("should not have these tests", func() {
|
||||
|
||||
})
|
||||
})
|
||||
13
vendor/github.com/onsi/ginkgo/integration/_fixtures/tags_tests/tags_tests_suite_test.go
generated
vendored
13
vendor/github.com/onsi/ginkgo/integration/_fixtures/tags_tests/tags_tests_suite_test.go
generated
vendored
@@ -1,13 +0,0 @@
|
||||
package tags_tests_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTagsTests(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "TagsTests Suite")
|
||||
}
|
||||
11
vendor/github.com/onsi/ginkgo/integration/_fixtures/tags_tests/tags_tests_test.go
generated
vendored
11
vendor/github.com/onsi/ginkgo/integration/_fixtures/tags_tests/tags_tests_test.go
generated
vendored
@@ -1,11 +0,0 @@
|
||||
package tags_tests_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
)
|
||||
|
||||
var _ = Describe("TagsTests", func() {
|
||||
It("should have a test", func() {
|
||||
|
||||
})
|
||||
})
|
||||
@@ -1,13 +0,0 @@
|
||||
package test_description_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestTestDescription(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "TestDescription Suite")
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package test_description_test
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("TestDescription", func() {
|
||||
It("should pass", func() {
|
||||
Ω(true).Should(BeTrue())
|
||||
})
|
||||
|
||||
It("should fail", func() {
|
||||
Ω(true).Should(BeFalse())
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
description := CurrentGinkgoTestDescription()
|
||||
fmt.Printf("%s:%t\n", description.FullTestText, description.Failed)
|
||||
})
|
||||
})
|
||||
7
vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/A/A.go
generated
vendored
7
vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/A/A.go
generated
vendored
@@ -1,7 +0,0 @@
|
||||
package A
|
||||
|
||||
import "github.com/onsi/B"
|
||||
|
||||
func DoIt() string {
|
||||
return B.DoIt()
|
||||
}
|
||||
13
vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/A/A_suite_test.go
generated
vendored
13
vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/A/A_suite_test.go
generated
vendored
@@ -1,13 +0,0 @@
|
||||
package A_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestA(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "A Suite")
|
||||
}
|
||||
14
vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/A/A_test.go
generated
vendored
14
vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/A/A_test.go
generated
vendored
@@ -1,14 +0,0 @@
|
||||
package A_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/A"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("A", func() {
|
||||
It("should do it", func() {
|
||||
Ω(DoIt()).Should(Equal("done!"))
|
||||
})
|
||||
})
|
||||
7
vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/B/B.go
generated
vendored
7
vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/B/B.go
generated
vendored
@@ -1,7 +0,0 @@
|
||||
package B
|
||||
|
||||
import "github.com/onsi/C"
|
||||
|
||||
func DoIt() string {
|
||||
return C.DoIt()
|
||||
}
|
||||
13
vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/B/B_suite_test.go
generated
vendored
13
vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/B/B_suite_test.go
generated
vendored
@@ -1,13 +0,0 @@
|
||||
package B_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestB(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "B Suite")
|
||||
}
|
||||
14
vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/B/B_test.go
generated
vendored
14
vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/B/B_test.go
generated
vendored
@@ -1,14 +0,0 @@
|
||||
package B_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/B"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("B", func() {
|
||||
It("should do it", func() {
|
||||
Ω(DoIt()).Should(Equal("done!"))
|
||||
})
|
||||
})
|
||||
5
vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/C/C.go
generated
vendored
5
vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/C/C.go
generated
vendored
@@ -1,5 +0,0 @@
|
||||
package C
|
||||
|
||||
func DoIt() string {
|
||||
return "done!"
|
||||
}
|
||||
13
vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/C/C_suite_test.go
generated
vendored
13
vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/C/C_suite_test.go
generated
vendored
@@ -1,13 +0,0 @@
|
||||
package C_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestC(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "C Suite")
|
||||
}
|
||||
14
vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/C/C_test.go
generated
vendored
14
vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/C/C_test.go
generated
vendored
@@ -1,14 +0,0 @@
|
||||
package C_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/C"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("C", func() {
|
||||
It("should do it", func() {
|
||||
Ω(DoIt()).Should(Equal("done!"))
|
||||
})
|
||||
})
|
||||
7
vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/D/D.go
generated
vendored
7
vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/D/D.go
generated
vendored
@@ -1,7 +0,0 @@
|
||||
package D
|
||||
|
||||
import "github.com/onsi/C"
|
||||
|
||||
func DoIt() string {
|
||||
return C.DoIt()
|
||||
}
|
||||
13
vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/D/D_suite_test.go
generated
vendored
13
vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/D/D_suite_test.go
generated
vendored
@@ -1,13 +0,0 @@
|
||||
package D_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestD(t *testing.T) {
|
||||
RegisterFailHandler(Fail)
|
||||
RunSpecs(t, "D Suite")
|
||||
}
|
||||
14
vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/D/D_test.go
generated
vendored
14
vendor/github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/D/D_test.go
generated
vendored
@@ -1,14 +0,0 @@
|
||||
package D_test
|
||||
|
||||
import (
|
||||
. "github.com/onsi/ginkgo/integration/_fixtures/watch_fixtures/C"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("D", func() {
|
||||
It("should do it", func() {
|
||||
Ω(DoIt()).Should(Equal("done!"))
|
||||
})
|
||||
})
|
||||
5
vendor/github.com/onsi/ginkgo/integration/_fixtures/xunit_tests/xunit_tests.go
generated
vendored
5
vendor/github.com/onsi/ginkgo/integration/_fixtures/xunit_tests/xunit_tests.go
generated
vendored
@@ -1,5 +0,0 @@
|
||||
package xunit_tests
|
||||
|
||||
func AlwaysTrue() bool {
|
||||
return true
|
||||
}
|
||||
11
vendor/github.com/onsi/ginkgo/integration/_fixtures/xunit_tests/xunit_tests_test.go
generated
vendored
11
vendor/github.com/onsi/ginkgo/integration/_fixtures/xunit_tests/xunit_tests_test.go
generated
vendored
@@ -1,11 +0,0 @@
|
||||
package xunit_tests
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestAlwaysTrue(t *testing.T) {
|
||||
if AlwaysTrue() != true {
|
||||
t.Errorf("Expected true, got false")
|
||||
}
|
||||
}
|
||||
121
vendor/github.com/onsi/ginkgo/integration/convert_test.go
generated
vendored
121
vendor/github.com/onsi/ginkgo/integration/convert_test.go
generated
vendored
@@ -1,121 +0,0 @@
|
||||
package integration_test
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
)
|
||||
|
||||
var _ = Describe("ginkgo convert", func() {
|
||||
var tmpDir string
|
||||
|
||||
readConvertedFileNamed := func(pathComponents ...string) string {
|
||||
pathToFile := filepath.Join(tmpDir, "convert_fixtures", filepath.Join(pathComponents...))
|
||||
bytes, err := ioutil.ReadFile(pathToFile)
|
||||
ExpectWithOffset(1, err).NotTo(HaveOccurred())
|
||||
|
||||
return string(bytes)
|
||||
}
|
||||
|
||||
readGoldMasterNamed := func(filename string) string {
|
||||
bytes, err := ioutil.ReadFile(filepath.Join("_fixtures", "convert_goldmasters", filename))
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
|
||||
return string(bytes)
|
||||
}
|
||||
|
||||
BeforeEach(func() {
|
||||
var err error
|
||||
|
||||
tmpDir, err = ioutil.TempDir("", "ginkgo-convert")
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
|
||||
err = exec.Command("cp", "-r", filepath.Join("_fixtures", "convert_fixtures"), tmpDir).Run()
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
})
|
||||
|
||||
JustBeforeEach(func() {
|
||||
cwd, err := os.Getwd()
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
|
||||
relPath, err := filepath.Rel(cwd, filepath.Join(tmpDir, "convert_fixtures"))
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
|
||||
cmd := exec.Command(pathToGinkgo, "convert", relPath)
|
||||
cmd.Env = os.Environ()
|
||||
for i, env := range cmd.Env {
|
||||
if strings.HasPrefix(env, "PATH") {
|
||||
cmd.Env[i] = cmd.Env[i] + ":" + filepath.Dir(pathToGinkgo)
|
||||
break
|
||||
}
|
||||
}
|
||||
err = cmd.Run()
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
})
|
||||
|
||||
AfterEach(func() {
|
||||
err := os.RemoveAll(tmpDir)
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("rewrites xunit tests as ginkgo tests", func() {
|
||||
convertedFile := readConvertedFileNamed("xunit_test.go")
|
||||
goldMaster := readGoldMasterNamed("xunit_test.go")
|
||||
Ω(convertedFile).Should(Equal(goldMaster))
|
||||
})
|
||||
|
||||
It("rewrites all usages of *testing.T as mr.T()", func() {
|
||||
convertedFile := readConvertedFileNamed("extra_functions_test.go")
|
||||
goldMaster := readGoldMasterNamed("extra_functions_test.go")
|
||||
Ω(convertedFile).Should(Equal(goldMaster))
|
||||
})
|
||||
|
||||
It("rewrites tests in the package dir that belong to other packages", func() {
|
||||
convertedFile := readConvertedFileNamed("outside_package_test.go")
|
||||
goldMaster := readGoldMasterNamed("outside_package_test.go")
|
||||
Ω(convertedFile).Should(Equal(goldMaster))
|
||||
})
|
||||
|
||||
It("rewrites tests in nested packages", func() {
|
||||
convertedFile := readConvertedFileNamed("nested", "nested_test.go")
|
||||
goldMaster := readGoldMasterNamed("nested_test.go")
|
||||
Ω(convertedFile).Should(Equal(goldMaster))
|
||||
})
|
||||
|
||||
Context("ginkgo test suite files", func() {
|
||||
It("creates a ginkgo test suite file for the package you specified", func() {
|
||||
testsuite := readConvertedFileNamed("convert_fixtures_suite_test.go")
|
||||
goldMaster := readGoldMasterNamed("suite_test.go")
|
||||
Ω(testsuite).Should(Equal(goldMaster))
|
||||
})
|
||||
|
||||
It("converts go tests in deeply nested packages (some may not contain go files)", func() {
|
||||
testsuite := readConvertedFileNamed("nested_without_gofiles", "subpackage", "nested_subpackage_test.go")
|
||||
goldMaster := readGoldMasterNamed("nested_subpackage_test.go")
|
||||
Ω(testsuite).Should(Equal(goldMaster))
|
||||
})
|
||||
|
||||
It("creates ginkgo test suites for all nested packages", func() {
|
||||
testsuite := readConvertedFileNamed("nested", "nested_suite_test.go")
|
||||
goldMaster := readGoldMasterNamed("nested_suite_test.go")
|
||||
Ω(testsuite).Should(Equal(goldMaster))
|
||||
})
|
||||
})
|
||||
|
||||
Context("with an existing test suite file", func() {
|
||||
BeforeEach(func() {
|
||||
goldMaster := readGoldMasterNamed("fixtures_suite_test.go")
|
||||
err := ioutil.WriteFile(filepath.Join(tmpDir, "convert_fixtures", "tmp_suite_test.go"), []byte(goldMaster), 0600)
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("gracefully handles existing test suite files", func() {
|
||||
//nothing should have gone wrong!
|
||||
})
|
||||
})
|
||||
})
|
||||
54
vendor/github.com/onsi/ginkgo/integration/coverage_test.go
generated
vendored
54
vendor/github.com/onsi/ginkgo/integration/coverage_test.go
generated
vendored
@@ -1,54 +0,0 @@
|
||||
package integration_test
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/exec"
|
||||
|
||||
. "github.com/onsi/ginkgo"
|
||||
. "github.com/onsi/gomega"
|
||||
"github.com/onsi/gomega/gexec"
|
||||
)
|
||||
|
||||
var _ = Describe("Coverage Specs", func() {
|
||||
AfterEach(func() {
|
||||
os.RemoveAll("./_fixtures/coverage_fixture/coverage_fixture.coverprofile")
|
||||
})
|
||||
|
||||
It("runs coverage analysis in series and in parallel", func() {
|
||||
session := startGinkgo("./_fixtures/coverage_fixture", "-cover")
|
||||
Eventually(session).Should(gexec.Exit(0))
|
||||
output := session.Out.Contents()
|
||||
Ω(output).Should(ContainSubstring("coverage: 80.0% of statements"))
|
||||
|
||||
serialCoverProfileOutput, err := exec.Command("go", "tool", "cover", "-func=./_fixtures/coverage_fixture/coverage_fixture.coverprofile").CombinedOutput()
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
|
||||
os.RemoveAll("./_fixtures/coverage_fixture/coverage_fixture.coverprofile")
|
||||
|
||||
Eventually(startGinkgo("./_fixtures/coverage_fixture", "-cover", "-nodes=4")).Should(gexec.Exit(0))
|
||||
|
||||
parallelCoverProfileOutput, err := exec.Command("go", "tool", "cover", "-func=./_fixtures/coverage_fixture/coverage_fixture.coverprofile").CombinedOutput()
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
|
||||
Ω(parallelCoverProfileOutput).Should(Equal(serialCoverProfileOutput))
|
||||
})
|
||||
|
||||
It("runs coverage analysis on external packages in series and in parallel", func() {
|
||||
session := startGinkgo("./_fixtures/coverage_fixture", "-coverpkg=github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture,github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture/external_coverage_fixture")
|
||||
Eventually(session).Should(gexec.Exit(0))
|
||||
output := session.Out.Contents()
|
||||
Ω(output).Should(ContainSubstring("coverage: 71.4% of statements in github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture, github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture/external_coverage_fixture"))
|
||||
|
||||
serialCoverProfileOutput, err := exec.Command("go", "tool", "cover", "-func=./_fixtures/coverage_fixture/coverage_fixture.coverprofile").CombinedOutput()
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
|
||||
os.RemoveAll("./_fixtures/coverage_fixture/coverage_fixture.coverprofile")
|
||||
|
||||
Eventually(startGinkgo("./_fixtures/coverage_fixture", "-coverpkg=github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture,github.com/onsi/ginkgo/integration/_fixtures/coverage_fixture/external_coverage_fixture", "-nodes=4")).Should(gexec.Exit(0))
|
||||
|
||||
parallelCoverProfileOutput, err := exec.Command("go", "tool", "cover", "-func=./_fixtures/coverage_fixture/coverage_fixture.coverprofile").CombinedOutput()
|
||||
Ω(err).ShouldNot(HaveOccurred())
|
||||
|
||||
Ω(parallelCoverProfileOutput).Should(Equal(serialCoverProfileOutput))
|
||||
})
|
||||
})
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user