From 7f9e2e504728c47386f04ec0b8569f3104c6d1d8 Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Tue, 21 Nov 2023 17:41:34 +0300 Subject: [PATCH] cli/sc: don't rewrite RPC bindings by default TestAssistedRPCBindings didn't respect rewriteExpectedOutputs setting, with this behavior compiler could produce any result and the test wouldn't notice. Signed-off-by: Roman Khimov --- cli/smartcontract/generate_test.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cli/smartcontract/generate_test.go b/cli/smartcontract/generate_test.go index dffc1892e..4f09544a5 100644 --- a/cli/smartcontract/generate_test.go +++ b/cli/smartcontract/generate_test.go @@ -395,6 +395,7 @@ func TestAssistedRPCBindings(t *testing.T) { } testName += fmt.Sprintf(", predefined hash: %t", hasDefinedHash) t.Run(testName, func(t *testing.T) { + outFile := filepath.Join(tmpDir, "out.go") configFile := filepath.Join(source, "config.yml") expectedFile := filepath.Join(source, "rpcbindings.out") if len(suffix) != 0 { @@ -421,14 +422,14 @@ func TestAssistedRPCBindings(t *testing.T) { cmds := []string{"", "contract", "generate-rpcwrapper", "--config", bindingF, "--manifest", manifestF, - "--out", expectedFile, + "--out", outFile, } if hasDefinedHash { cmds = append(cmds, "--hash", "0x00112233445566778899aabbccddeeff00112233") } require.NoError(t, app.Run(cmds)) - data, err := os.ReadFile(expectedFile) + data, err := os.ReadFile(outFile) require.NoError(t, err) data = bytes.ReplaceAll(data, []byte("\r"), []byte{}) // Windows. if rewriteExpectedOutputs {