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:
parent
aa76383fa7
commit
f0100407ee
1 changed files with 1 additions and 14 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue