mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-23 03:41:34 +00:00
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:
parent
1f8ccdba16
commit
b997eeb051
4 changed files with 12 additions and 5 deletions
|
@ -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"
|
||||
|
|
|
@ -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",
|
||||
|
|
Loading…
Reference in a new issue