lint + unused
Этот коммит содержится в:
родитель
5c352074bc
коммит
5bd9dce5d6
6 изменённых файлов: 23 добавлений и 63 удалений
|
@ -19,16 +19,15 @@ import (
|
|||
"unicode"
|
||||
)
|
||||
|
||||
var tooldir = findToolDir()
|
||||
var compiler = filepath.Join(tooldir, "compile")
|
||||
var linker = filepath.Join(tooldir, "link")
|
||||
var gopaths = filepath.SplitList(build.Default.GOPATH)
|
||||
var goarch = build.Default.GOARCH
|
||||
var goroot = build.Default.GOROOT
|
||||
var goos = build.Default.GOOS
|
||||
var (
|
||||
tooldir = findToolDir()
|
||||
compiler = filepath.Join(tooldir, "compile")
|
||||
linker = filepath.Join(tooldir, "link")
|
||||
gopaths = filepath.SplitList(build.Default.GOPATH)
|
||||
godogImportPath = "github.com/DATA-DOG/godog"
|
||||
|
||||
var godogImportPath = "github.com/DATA-DOG/godog"
|
||||
var runnerTemplate = template.Must(template.New("testmain").Parse(`package main
|
||||
// godep
|
||||
runnerTemplate = template.Must(template.New("testmain").Parse(`package main
|
||||
|
||||
import (
|
||||
"github.com/DATA-DOG/godog"
|
||||
|
@ -45,6 +44,7 @@ func main() {
|
|||
})
|
||||
os.Exit(status)
|
||||
}`))
|
||||
)
|
||||
|
||||
// Build creates a test package like go test command at given target path.
|
||||
// If there are no go files in tested directory, then
|
||||
|
@ -299,17 +299,6 @@ func makeImportValid(r rune) rune {
|
|||
return r
|
||||
}
|
||||
|
||||
func uniqStringList(strs []string) (unique []string) {
|
||||
uniq := make(map[string]void, len(strs))
|
||||
for _, s := range strs {
|
||||
if _, ok := uniq[s]; !ok {
|
||||
uniq[s] = void{}
|
||||
unique = append(unique, s)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// buildTestMain if given package is valid
|
||||
// it scans test files for contexts
|
||||
// and produces a testmain source code.
|
||||
|
|
|
@ -27,7 +27,7 @@ func TestBuildTestRunnerWithoutGoFiles(t *testing.T) {
|
|||
}
|
||||
|
||||
defer func() {
|
||||
os.Chdir(pwd) // get back to current dir
|
||||
_ = os.Chdir(pwd) // get back to current dir
|
||||
}()
|
||||
|
||||
if err := Build(bin); err != nil {
|
||||
|
|
|
@ -3,12 +3,10 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
"go/build"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"syscall"
|
||||
|
||||
"github.com/DATA-DOG/godog"
|
||||
|
@ -107,20 +105,3 @@ func main() {
|
|||
}
|
||||
os.Exit(status)
|
||||
}
|
||||
|
||||
func statusOutputFilter(w io.Writer) io.Writer {
|
||||
return writerFunc(func(b []byte) (int, error) {
|
||||
if m := statusMatch.FindStringSubmatch(string(b)); len(m) > 1 {
|
||||
parsedStatus, _ = strconv.Atoi(m[1])
|
||||
// skip status stderr output
|
||||
return len(b), nil
|
||||
}
|
||||
return w.Write(b)
|
||||
})
|
||||
}
|
||||
|
||||
type writerFunc func([]byte) (int, error)
|
||||
|
||||
func (w writerFunc) Write(b []byte) (int, error) {
|
||||
return w(b)
|
||||
}
|
||||
|
|
13
fmt.go
13
fmt.go
|
@ -381,9 +381,11 @@ func (f *basefmt) Summary() {
|
|||
}
|
||||
|
||||
func (s *undefinedSnippet) Args() (ret string) {
|
||||
var args []string
|
||||
var pos, idx int
|
||||
var breakLoop bool
|
||||
var (
|
||||
args []string
|
||||
pos int
|
||||
breakLoop bool
|
||||
)
|
||||
for !breakLoop {
|
||||
part := s.Expr[pos:]
|
||||
ipos := strings.Index(part, "(\\d+)")
|
||||
|
@ -392,25 +394,20 @@ func (s *undefinedSnippet) Args() (ret string) {
|
|||
case spos == -1 && ipos == -1:
|
||||
breakLoop = true
|
||||
case spos == -1:
|
||||
idx++
|
||||
pos += ipos + len("(\\d+)")
|
||||
args = append(args, reflect.Int.String())
|
||||
case ipos == -1:
|
||||
idx++
|
||||
pos += spos + len("\"([^\"]*)\"")
|
||||
args = append(args, reflect.String.String())
|
||||
case ipos < spos:
|
||||
idx++
|
||||
pos += ipos + len("(\\d+)")
|
||||
args = append(args, reflect.Int.String())
|
||||
case spos < ipos:
|
||||
idx++
|
||||
pos += spos + len("\"([^\"]*)\"")
|
||||
args = append(args, reflect.String.String())
|
||||
}
|
||||
}
|
||||
if s.argument != nil {
|
||||
idx++
|
||||
switch s.argument.(type) {
|
||||
case *gherkin.DocString:
|
||||
args = append(args, "*gherkin.DocString")
|
||||
|
|
|
@ -111,7 +111,6 @@ type cukefmt struct {
|
|||
// threaded execution. Unless running a copy of formatter for each feature
|
||||
path string
|
||||
stat stepType // last step status, before skipped
|
||||
outlineSteps int // number of current outline scenario steps
|
||||
ID string // current test id.
|
||||
results []cukeFeatureJSON // structure that represent cuke results
|
||||
curStep *cukeStep // track the current step
|
||||
|
|
6
suite.go
6
suite.go
|
@ -402,12 +402,6 @@ func (s *Suite) runSteps(steps []*gherkin.Step) (err error) {
|
|||
return
|
||||
}
|
||||
|
||||
func (s *Suite) skipSteps(steps []*gherkin.Step) {
|
||||
for _, step := range steps {
|
||||
s.fmt.Skipped(step, s.matchStep(step))
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Suite) runOutline(outline *gherkin.ScenarioOutline, b *gherkin.Background) (failErr error) {
|
||||
s.fmt.Node(outline)
|
||||
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче