mirror of
https://github.com/jstemmer/go-junit-report.git
synced 2025-04-04 20:50:14 -05:00
Add -id flag to generate-golden to generate report for a single testcase
This commit is contained in:
parent
bbb5123976
commit
9cd24c25d1
10
testdata/generate-golden.go
vendored
10
testdata/generate-golden.go
vendored
@ -32,8 +32,10 @@ var fileSettings = map[string]Settings{
|
||||
|
||||
func main() {
|
||||
var writeFiles bool
|
||||
var id int
|
||||
flag.BoolVar(&verbose, "v", false, "verbose logging")
|
||||
flag.BoolVar(&writeFiles, "w", false, "write output xml files")
|
||||
flag.IntVar(&id, "id", 0, "generate report for given id only")
|
||||
flag.Parse()
|
||||
|
||||
files, err := filepath.Glob("*.txt")
|
||||
@ -41,7 +43,15 @@ func main() {
|
||||
exitf("error listing files: %v\n", err)
|
||||
}
|
||||
|
||||
var idPrefix string
|
||||
if id > 0 {
|
||||
idPrefix = fmt.Sprintf("%03d-", id)
|
||||
}
|
||||
for _, file := range files {
|
||||
if idPrefix != "" && !strings.HasPrefix(file, idPrefix) {
|
||||
continue
|
||||
}
|
||||
|
||||
outName := outputName(file)
|
||||
if err := createReportFromInput(file, outName, writeFiles); err != nil {
|
||||
logf("error creating report: %v\n", err)
|
||||
|
Loading…
x
Reference in New Issue
Block a user