From c67d249a8d80971e215d759f681bb71c7d0d342f Mon Sep 17 00:00:00 2001 From: AnnaShaleva Date: Tue, 30 Nov 2021 20:13:52 +0300 Subject: [PATCH] vm: fix cli tests * Remove extra symbols during command execution. * Fix test contract paths. --- pkg/vm/cli/cli_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pkg/vm/cli/cli_test.go b/pkg/vm/cli/cli_test.go index 83c7d1453..b6d266cef 100644 --- a/pkg/vm/cli/cli_test.go +++ b/pkg/vm/cli/cli_test.go @@ -77,6 +77,9 @@ func newTestVMCLIWithLogo(t *testing.T, printLogo bool) *executor { Prompt: "", Stdin: e.in, Stdout: e.out, + FuncIsTerminal: func() bool { + return false + }, }) return e } @@ -202,8 +205,10 @@ func TestLoad(t *testing.T) { t.Run("loadgo", func(t *testing.T) { filename := filepath.Join(tmpDir, "vmtestcontract.go") require.NoError(t, ioutil.WriteFile(filename, []byte(src), os.ModePerm)) + filename = "'" + filename + "'" filenameErr := filepath.Join(tmpDir, "vmtestcontract_err.go") require.NoError(t, ioutil.WriteFile(filenameErr, []byte(src+"invalid_token"), os.ModePerm)) + filenameErr = "'" + filenameErr + "'" e := newTestVMCLI(t) e.runProg(t, @@ -227,6 +232,7 @@ func TestLoad(t *testing.T) { ` filename := filepath.Join(tmpDir, "vmtestcontract.go") require.NoError(t, ioutil.WriteFile(filename, []byte(srcAllowNotify), os.ModePerm)) + filename = "'" + filename + "'" e := newTestVMCLI(t) e.runProg(t, @@ -256,6 +262,10 @@ func TestLoad(t *testing.T) { require.NoError(t, ioutil.WriteFile(filenameErr, append([]byte{1, 2, 3, 4}, rawNef...), os.ModePerm)) notExists := filepath.Join(tmpDir, "notexists.json") + manifestFile = "'" + manifestFile + "'" + filename = "'" + filename + "'" + filenameErr = "'" + filenameErr + "'" + e := newTestVMCLI(t) e.runProg(t, "loadnef", @@ -297,6 +307,7 @@ func TestRunWithDifferentArguments(t *testing.T) { filename := filepath.Join(tmpDir, "run_vmtestcontract.go") require.NoError(t, ioutil.WriteFile(filename, []byte(src), os.ModePerm)) + filename = "'" + filename + "'" e := newTestVMCLI(t) e.runProg(t, "loadgo "+filename, "run notexists",