llgo cmptest -gen
This commit is contained in:
@@ -37,8 +37,8 @@ var Cmd = &base.Command{
|
|||||||
|
|
||||||
// llgo cmptest
|
// llgo cmptest
|
||||||
var CmpTestCmd = &base.Command{
|
var CmpTestCmd = &base.Command{
|
||||||
UsageLine: "llgo cmptest [-genexpect] [build flags] package [arguments...]",
|
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 -genexpect is specified",
|
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() {
|
func init() {
|
||||||
@@ -54,9 +54,9 @@ func runCmpTest(cmd *base.Command, args []string) {
|
|||||||
runCmdEx(cmd, args, build.ModeCmpTest)
|
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)
|
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
|
conf.GenExpect = true
|
||||||
args = args[1:]
|
args = args[1:]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,8 +68,8 @@ type Config struct {
|
|||||||
AppExt string // ".exe" on Windows, empty on Unix
|
AppExt string // ".exe" on Windows, empty on Unix
|
||||||
OutFile string // only valid for ModeBuild when len(pkgs) == 1
|
OutFile string // only valid for ModeBuild when len(pkgs) == 1
|
||||||
RunArgs []string // only valid for ModeRun
|
RunArgs []string // only valid for ModeRun
|
||||||
GenExpect bool // only valid for ModeCmpTest
|
|
||||||
Mode Mode
|
Mode Mode
|
||||||
|
GenExpect bool // only valid for ModeCmpTest
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewDefaultConf(mode Mode) *Config {
|
func NewDefaultConf(mode Mode) *Config {
|
||||||
|
|||||||
Reference in New Issue
Block a user