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
|
package token_contract
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"nep5"
|
"github.com/CityOfZion/neo-storm/examples/token/nep5"
|
||||||
|
|
||||||
"github.com/CityOfZion/neo-storm/interop/storage"
|
"github.com/CityOfZion/neo-storm/interop/storage"
|
||||||
"github.com/CityOfZion/neo-storm/interop/util"
|
"github.com/CityOfZion/neo-storm/interop/util"
|
||||||
|
|
|
@ -22,13 +22,11 @@ func TestExamplesFolder(t *testing.T) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
if len(infos) > 1 {
|
|
||||||
t.Fatal("detected smart contract folder with more than 1 contract file")
|
|
||||||
}
|
|
||||||
if len(infos) == 0 {
|
if len(infos) == 0 {
|
||||||
t.Fatal("detected smart contract folder with no contract in it")
|
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)
|
targetPath := path.Join(examplePath, info.Name(), filename)
|
||||||
if err := compileFile(targetPath); err != nil {
|
if err := compileFile(targetPath); err != nil {
|
||||||
t.Fatal(err)
|
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 {
|
func compileFile(src string) error {
|
||||||
o := compiler.Options{
|
o := compiler.Options{
|
||||||
Outfile: "tmp/contract.avm",
|
Outfile: "tmp/contract.avm",
|
||||||
|
|
Loading…
Reference in a new issue