From 6c72846d63dc8f63dbe580f2e432dc93081d91ba Mon Sep 17 00:00:00 2001 From: xushiwei Date: Wed, 14 Aug 2024 09:47:40 +0800 Subject: [PATCH] llgo cmptest -gen --- cmd/internal/run/run.go | 8 ++++---- internal/build/build.go | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cmd/internal/run/run.go b/cmd/internal/run/run.go index ec79238a..3317cfad 100644 --- a/cmd/internal/run/run.go +++ b/cmd/internal/run/run.go @@ -37,8 +37,8 @@ var Cmd = &base.Command{ // llgo cmptest var CmpTestCmd = &base.Command{ - UsageLine: "llgo cmptest [-genexpect] [build flags] package [arguments...]", - Short: "Compile and run with llgo, compare result (stdout/stderr/exitcode) with go or llgo.expect; generate llgo.expect file if -genexpect is specified", + UsageLine: "llgo cmptest [-gen] [build flags] package [arguments...]", + Short: "Compile and run with llgo, compare result (stdout/stderr/exitcode) with go or llgo.expect; generate llgo.expect file if -gen is specified", } func init() { @@ -54,9 +54,9 @@ func runCmpTest(cmd *base.Command, args []string) { runCmdEx(cmd, args, build.ModeCmpTest) } -func runCmdEx(cmd *base.Command, args []string, mode build.Mode) { +func runCmdEx(_ *base.Command, args []string, mode build.Mode) { conf := build.NewDefaultConf(mode) - if mode == build.ModeCmpTest && len(args) > 0 && args[0] == "-genexpect" { + if mode == build.ModeCmpTest && len(args) > 0 && args[0] == "-gen" { conf.GenExpect = true args = args[1:] } diff --git a/internal/build/build.go b/internal/build/build.go index 2c056199..557763ef 100644 --- a/internal/build/build.go +++ b/internal/build/build.go @@ -68,8 +68,8 @@ type Config struct { AppExt string // ".exe" on Windows, empty on Unix OutFile string // only valid for ModeBuild when len(pkgs) == 1 RunArgs []string // only valid for ModeRun - GenExpect bool // only valid for ModeCmpTest Mode Mode + GenExpect bool // only valid for ModeCmpTest } func NewDefaultConf(mode Mode) *Config {