mirror of
https://github.com/wader/fq.git
synced 2024-10-26 20:06:29 +03:00
Merge pull request #393 from wader/fqtest-speedup
Speed up tests by fixing script parser output collecting and run tests in parallell
This commit is contained in:
commit
fc0414dfc1
@ -374,6 +374,8 @@ type Section struct {
|
||||
LineNr int
|
||||
Name string
|
||||
Value string
|
||||
|
||||
valueSB strings.Builder
|
||||
}
|
||||
|
||||
func SectionParser(re *regexp.Regexp, s string) []Section {
|
||||
@ -407,11 +409,16 @@ func SectionParser(re *regexp.Regexp, s string) []Section {
|
||||
cs.LineNr = lineNr
|
||||
cs.Name = firstMatch(sm, func(s string) bool { return len(s) != 0 })
|
||||
} else {
|
||||
// TODO: use builder somehow if performance is needed
|
||||
cs.Value += l + lineDelim
|
||||
cs.valueSB.WriteString(l)
|
||||
cs.valueSB.WriteString(lineDelim)
|
||||
}
|
||||
}
|
||||
|
||||
for i := range sections {
|
||||
cs := §ions[i]
|
||||
cs.Value = cs.valueSB.String()
|
||||
}
|
||||
|
||||
return sections
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@ func TestPath(t *testing.T, registry *interp.Registry) {
|
||||
ColorDiff: os.Getenv("DIFF_COLOR") != "",
|
||||
WriteOutput: os.Getenv("WRITE_ACTUAL") != "",
|
||||
Fn: func(t *testing.T, path, input string) (string, string, error) {
|
||||
t.Parallel()
|
||||
|
||||
b, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
Loading…
Reference in New Issue
Block a user