updated RUN_TEST.GO

This commit is contained in:
AnilChinchawale 2018-05-24 15:44:23 +05:30
parent 5e07884497
commit a686a3dc05

View file

@ -27,14 +27,14 @@ import (
) )
func tmpdir(t *testing.T) string { func tmpdir(t *testing.T) string {
dir, err := ioutil.TempDir("", "geth-test") dir, err := ioutil.TempDir("", "XDC-test")
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
return dir return dir
} }
type testgeth struct { type testXDC struct {
*cmdtest.TestCmd *cmdtest.TestCmd
// template variables for expect // template variables for expect
@ -43,8 +43,8 @@ type testgeth struct {
} }
func init() { func init() {
// Run the app if we've been exec'd as "geth-test" in runGeth. // Run the app if we've been exec'd as "XDC-test" in runGeth.
reexec.Register("geth-test", func() { reexec.Register("XDC-test", func() {
if err := app.Run(os.Args); err != nil { if err := app.Run(os.Args); err != nil {
fmt.Fprintln(os.Stderr, err) fmt.Fprintln(os.Stderr, err)
os.Exit(1) os.Exit(1)
@ -61,10 +61,10 @@ func TestMain(m *testing.M) {
os.Exit(m.Run()) os.Exit(m.Run())
} }
// spawns geth with the given command line args. If the args don't set --datadir, the // spawns XDC with the given command line args. If the args don't set --datadir, the
// child g gets a temporary data directory. // child g gets a temporary data directory.
func runGeth(t *testing.T, args ...string) *testgeth { func runXDC(t *testing.T, args ...string) *testXDC {
tt := &testgeth{} tt := &testXDC{}
tt.TestCmd = cmdtest.NewTestCmd(t, tt) tt.TestCmd = cmdtest.NewTestCmd(t, tt)
for i, arg := range args { for i, arg := range args {
switch { switch {
@ -90,9 +90,9 @@ func runGeth(t *testing.T, args ...string) *testgeth {
}() }()
} }
// Boot "geth". This actually runs the test binary but the TestMain // Boot "XDC". This actually runs the test binary but the TestMain
// function will prevent any tests from running. // function will prevent any tests from running.
tt.Run("geth-test", args...) tt.Run("XDC-test", args...)
return tt return tt
} }