cli/smartcontract: generate bindings also for examples

We do compilation test for them, just to check that the compiler doesn't choke
for any reason, but we can do the same for wrapper generators.
This commit is contained in:
Roman Khimov 2022-11-09 12:50:57 +03:00
parent 145ebad90e
commit ea44367c97

View file

@ -1004,6 +1004,9 @@ func TestCompileExamples(t *testing.T) {
outF := filepath.Join(tmpDir, info.Name()+".nef") outF := filepath.Join(tmpDir, info.Name()+".nef")
manifestF := filepath.Join(tmpDir, info.Name()+".manifest.json") manifestF := filepath.Join(tmpDir, info.Name()+".manifest.json")
bindingF := filepath.Join(tmpDir, info.Name()+".binding.yml")
wrapperF := filepath.Join(tmpDir, info.Name()+".go")
rpcWrapperF := filepath.Join(tmpDir, info.Name()+".rpc.go")
cfgName := filterFilename(infos, ".yml") cfgName := filterFilename(infos, ".yml")
opts := []string{ opts := []string{
@ -1012,6 +1015,7 @@ func TestCompileExamples(t *testing.T) {
"--out", outF, "--out", outF,
"--manifest", manifestF, "--manifest", manifestF,
"--config", filepath.Join(examplePath, info.Name(), cfgName), "--config", filepath.Join(examplePath, info.Name(), cfgName),
"--bindings", bindingF,
} }
e.Run(t, opts...) e.Run(t, opts...)
@ -1030,6 +1034,16 @@ func TestCompileExamples(t *testing.T) {
require.NotNil(t, m.ABI.GetMethod("put", 1)) require.NotNil(t, m.ABI.GetMethod("put", 1))
require.NotNil(t, m.ABI.GetMethod("put", 2)) require.NotNil(t, m.ABI.GetMethod("put", 2))
} }
e.Run(t, "neo-go", "contract", "generate-wrapper",
"--manifest", manifestF,
"--config", bindingF,
"--out", wrapperF,
"--hash", "0x00112233445566778899aabbccddeeff00112233")
e.Run(t, "neo-go", "contract", "generate-rpcwrapper",
"--manifest", manifestF,
"--config", bindingF,
"--out", rpcWrapperF,
"--hash", "0x00112233445566778899aabbccddeeff00112233")
}) })
} }