diff --git a/README.md b/README.md index 941c41f..e2d217a 100644 --- a/README.md +++ b/README.md @@ -193,7 +193,7 @@ See implementation examples: **2016-06-14** - godog now uses **go tool compile** and **go tool link** to support vendor directory dependencies. It also compiles test executable the same - way as standard **go test** utility. With this change, go only go + way as standard **go test** utility. With this change, only go versions from **1.5** are now supported. **2016-06-01** diff --git a/builder.go b/builder.go index 42624ab..8db1ff2 100644 --- a/builder.go +++ b/builder.go @@ -40,18 +40,18 @@ func main() { os.Exit(status) }`)) -// Build scans clones current package into a temporary -// godog suite test package. +// Build creates a test package like go test command. +// If there are no go files in tested directory, then +// it simply builds a godog executable to scan features. // -// If there is a TestMain func in any of test.go files -// it removes it and all necessary unused imports related -// to this function. +// If there are go test files, it first builds a test +// package with standard go test command. // -// It also looks for any godog suite contexts and registers -// them in order to call them on execution. +// Finally it generates godog suite executable which +// registers exported godog contexts from the test files +// of tested package. // -// The test entry point which uses go1.4 TestMain func -// is generated from the template above. +// Returns the path to generated executable func Build() (string, error) { abs, err := filepath.Abs(".") if err != nil { @@ -228,10 +228,9 @@ func uniqStringList(strs []string) (unique []string) { return } -// buildTestPackage clones a package and adds a godog -// entry point with TestMain func in order to -// run the test suite. If TestMain func is found in tested -// source, it will be removed so it can be replaced +// buildTestMain if given package is valid +// it scans test files for contexts +// and produces a testmain source code. func buildTestMain(pkg *build.Package) ([]byte, bool, error) { var contexts []string var importPath string @@ -261,8 +260,8 @@ func buildTestMain(pkg *build.Package) ([]byte, bool, error) { } // processPackageTestFiles runs through ast of each test -// file pack and removes TestMain func if found. it also -// looks for godog suite contexts to register on run +// file pack and looks for godog suite contexts to register +// on run func processPackageTestFiles(packs ...[]string) ([]string, error) { var ctxs []string fset := token.NewFileSet() diff --git a/examples/api/version.feature b/examples/api/version.feature index e591714..16c730b 100644 --- a/examples/api/version.feature +++ b/examples/api/version.feature @@ -20,6 +20,6 @@ Feature: get version And the response should match json: """ { - "version": "v0.4.3" + "version": "v0.5.0" } """ diff --git a/godog.go b/godog.go index 5bc9cb1..6459886 100644 --- a/godog.go +++ b/godog.go @@ -42,4 +42,4 @@ Godog was inspired by Behat and Cucumber the above description is taken from it' package godog // Version of package - based on Semantic Versioning 2.0.0 http://semver.org/ -const Version = "v0.4.3" +const Version = "v0.5.0"