From 2f78ae258c1315746f9a0c1d1bb05a8f18cd93bd Mon Sep 17 00:00:00 2001 From: Jeff Thompson Date: Tue, 5 Mar 2024 18:17:36 +0100 Subject: [PATCH] chore: In integration setupGnolandTestScript, use strconv.Unquote on args Signed-off-by: Jeff Thompson --- gno.land/pkg/integration/testing_integration.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gno.land/pkg/integration/testing_integration.go b/gno.land/pkg/integration/testing_integration.go index 26f95935c88..b3c39302cc3 100644 --- a/gno.land/pkg/integration/testing_integration.go +++ b/gno.land/pkg/integration/testing_integration.go @@ -220,6 +220,17 @@ func setupGnolandTestScript(t *testing.T, txtarDir string) testscript.Params { logger := ts.Value(envKeyLogger).(*slog.Logger) // grab logger sid := ts.Getenv("SID") // grab session id + var err error + for i, arg := range args { + if len(arg) < 2 || !strings.HasPrefix(arg, `"`) || !strings.HasSuffix(arg, `"`) { + continue + } + + if args[i], err = strconv.Unquote(arg); err != nil { + ts.Fatalf("unable to unquote %s: %w ", arg, err) + } + } + // Setup IO command io := commands.NewTestIO() io.SetOut(commands.WriteNopCloser(ts.Stdout())) @@ -250,7 +261,7 @@ func setupGnolandTestScript(t *testing.T, txtarDir string) testscript.Params { // user provided. args = append(defaultArgs, args...) - err := cmd.ParseAndRun(context.Background(), args) + err = cmd.ParseAndRun(context.Background(), args) tsValidateError(ts, "gnokey", neg, err) },