compiler/test: compile whole directory in examples

For `nft-nd-nns` example only `namestate.go` file was compiled which is
certainly not what we want.

Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgeniy Stratonikov 2021-06-25 11:02:43 +03:00
parent aa76383fa7
commit f0100407ee

View file

@ -57,12 +57,8 @@ func TestCompiler(t *testing.T) {
// there are also a couple of files inside the `examplePath` which doesn't need to be compiled
continue
}
infos, err := ioutil.ReadDir(path.Join(examplePath, info.Name()))
require.NoError(t, err)
require.False(t, len(infos) == 0, "detected smart contract folder with no contract in it")
filename := filterFilename(infos)
targetPath := path.Join(examplePath, info.Name(), filename)
targetPath := path.Join(examplePath, info.Name())
require.NoError(t, compileFile(targetPath))
}
},
@ -90,15 +86,6 @@ func TestCompiler(t *testing.T) {
}
}
func filterFilename(infos []os.FileInfo) string {
for _, info := range infos {
if !info.IsDir() {
return info.Name()
}
}
return ""
}
func compileFile(src string) error {
_, err := compiler.Compile(src, nil)
return err