From ddfbf7a4349d72aa63a19a4423844812652fb8b5 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Fri, 19 May 2023 13:22:20 +0300 Subject: [PATCH] cli: remove code duplication in test Signed-off-by: Anna Shaleva --- cli/vm/cli_test.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/cli/vm/cli_test.go b/cli/vm/cli_test.go index 65252aa9b..4ccc29606 100644 --- a/cli/vm/cli_test.go +++ b/cli/vm/cli_test.go @@ -474,15 +474,8 @@ func TestLoad(t *testing.T) { tmpDir := t.TempDir() checkLoadgo := func(t *testing.T, cName, cErrName string) { - filename := filepath.Join(tmpDir, cName) - require.NoError(t, os.WriteFile(filename, []byte(src), os.ModePerm)) - filename = "'" + filename + "'" + filename := prepareLoadgoSrc(t, tmpDir, src) filenameErr := filepath.Join(tmpDir, cErrName) - require.NoError(t, os.WriteFile(filenameErr, []byte(src+"invalid_token"), os.ModePerm)) - filenameErr = "'" + filenameErr + "'" - goMod := []byte(`module test.example/vmcli -go 1.18`) - require.NoError(t, os.WriteFile(filepath.Join(tmpDir, "go.mod"), goMod, os.ModePerm)) e := newTestVMCLI(t) e.runProgWithTimeout(t, 10*time.Second,