diff --git a/testscript/exe.go b/testscript/exe.go index 3c3579e7..e163a769 100644 --- a/testscript/exe.go +++ b/testscript/exe.go @@ -122,7 +122,7 @@ func RunMain(m TestingM, commands map[string]func() int) (exitCode int) { } scriptCmds[name] = func(ts *TestScript, neg bool, args []string) { if ts.params.RequireExplicitExec { - ts.Fatalf("use 'exec %s' rather than '%s' (because RequireExplicitExec is enabled)", args[0], args[0]) + ts.Fatalf("use 'exec %s' rather than '%s' (because RequireExplicitExec is enabled)", name, name) } ts.cmdExec(neg, append([]string{name}, args...)) } diff --git a/testscript/testdata/testscript_explicit_exec.txt b/testscript/testdata/testscript_explicit_exec.txt index c2fc0a6a..cc818696 100644 --- a/testscript/testdata/testscript_explicit_exec.txt +++ b/testscript/testdata/testscript_explicit_exec.txt @@ -9,8 +9,8 @@ unquote scripts-explicit/testscript.txt testscript scripts-implicit testscript scripts-explicit -! testscript -verbose -explicit-exec scripts-implicit -testscript -verbose -explicit-exec scripts-explicit +! testscript -explicit-exec scripts-implicit +testscript -explicit-exec scripts-explicit -- scripts-implicit/testscript.txt -- >fprintargs stdout right