fixed token example and fixed compiler test with multiple dirs (CityOfZion/neo-storm#20)

Imported from CityOfZion/neo-storm (2d0814a04c34f320dee41674066ccd766a7a8ea1).
This commit is contained in:
Anthony De Meulemeester 2018-08-22 19:07:36 +02:00 committed by Roman Khimov
parent 1f8ccdba16
commit b997eeb051
4 changed files with 12 additions and 5 deletions

View file

@ -1,7 +1,7 @@
package token_contract
import (
"nep5"
"github.com/CityOfZion/neo-storm/examples/token/nep5"
"github.com/CityOfZion/neo-storm/interop/storage"
"github.com/CityOfZion/neo-storm/interop/util"

View file

@ -22,13 +22,11 @@ func TestExamplesFolder(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if len(infos) > 1 {
t.Fatal("detected smart contract folder with more than 1 contract file")
}
if len(infos) == 0 {
t.Fatal("detected smart contract folder with no contract in it")
}
filename := infos[0].Name()
filename := filterFilename(infos)
targetPath := path.Join(examplePath, info.Name(), filename)
if err := compileFile(targetPath); err != nil {
t.Fatal(err)
@ -36,6 +34,15 @@ func TestExamplesFolder(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 {
o := compiler.Options{
Outfile: "tmp/contract.avm",