Skip to content

Commit f1823ea

Browse files
committed
Generator: Name tests as they appear in the output, fix unstashing (more needed)
1 parent b536255 commit f1823ea

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

internal/cmd/generate/commands/gentests/generator.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ func (g *Generator) Output() (io.Reader, error) {
7272
for i, t := range g.TestSuite.Tests {
7373
g.w("\n")
7474
g.genLocationYAML(t)
75-
g.w("\t" + `t.Run("` + t.Name + `", ` + "func(t *testing.T) {\n")
75+
g.w("\t" + `t.Run("` + strings.ReplaceAll(t.Name, " ", "_") + `", ` + "func(t *testing.T) {\n")
7676
if !g.genSkip(t) {
7777
g.w("\tdefer recoverPanic(t)\n")
7878
g.w("\tcommonSetup()\n")
@@ -889,7 +889,7 @@ func (g *Generator) genAction(a Action, skipBody ...bool) {
889889
// fmt.Printf("%s.%s: <%T> %v\n", a.Request(), k, v, v)
890890

891891
if strings.HasPrefix(fmt.Sprintf("%s", v), "$") {
892-
v = `stash[` + strconv.Quote(fmt.Sprintf("%s", v)) + `]`
892+
v = `stash[` + strconv.Quote(strings.ReplaceAll(strings.ReplaceAll(fmt.Sprintf("%s", v), "{", ""), "}", "")) + `]`
893893
}
894894

895895
switch v.(type) {

0 commit comments

Comments
 (0)