Skip to content

Commit

Permalink
Merge pull request goplus#708 from xushiwei/q
Browse files Browse the repository at this point in the history
llgo cmptest -gen
  • Loading branch information
xushiwei authored Aug 14, 2024
2 parents 6484a8e + 6c72846 commit 61c6f24
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions cmd/internal/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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:]
}
Expand Down
2 changes: 1 addition & 1 deletion internal/build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 61c6f24

Please sign in to comment.