mirror of
https://github.com/jstemmer/go-junit-report.git
synced 2025-04-05 05:00:15 -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() {
|
func main() {
|
||||||
var writeFiles bool
|
var writeFiles bool
|
||||||
|
var id int
|
||||||
flag.BoolVar(&verbose, "v", false, "verbose logging")
|
flag.BoolVar(&verbose, "v", false, "verbose logging")
|
||||||
flag.BoolVar(&writeFiles, "w", false, "write output xml files")
|
flag.BoolVar(&writeFiles, "w", false, "write output xml files")
|
||||||
|
flag.IntVar(&id, "id", 0, "generate report for given id only")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
files, err := filepath.Glob("*.txt")
|
files, err := filepath.Glob("*.txt")
|
||||||
@ -41,7 +43,15 @@ func main() {
|
|||||||
exitf("error listing files: %v\n", err)
|
exitf("error listing files: %v\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var idPrefix string
|
||||||
|
if id > 0 {
|
||||||
|
idPrefix = fmt.Sprintf("%03d-", id)
|
||||||
|
}
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
|
if idPrefix != "" && !strings.HasPrefix(file, idPrefix) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
outName := outputName(file)
|
outName := outputName(file)
|
||||||
if err := createReportFromInput(file, outName, writeFiles); err != nil {
|
if err := createReportFromInput(file, outName, writeFiles); err != nil {
|
||||||
logf("error creating report: %v\n", err)
|
logf("error creating report: %v\n", err)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user