diff options
author | zelig <viktor.tron@gmail.com> | 2015-05-20 11:11:48 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2015-05-20 11:11:48 +0800 |
commit | b0ae84aa0dae65f00492f981bb61887331def2a5 (patch) | |
tree | 369d5c342c6df8b5486c386663806937a4d9def1 /common/compiler/solidity_test.go | |
parent | ea893aca8fbda0d821424ab7509a0a0cfef1f77d (diff) | |
download | dexon-b0ae84aa0dae65f00492f981bb61887331def2a5.tar dexon-b0ae84aa0dae65f00492f981bb61887331def2a5.tar.gz dexon-b0ae84aa0dae65f00492f981bb61887331def2a5.tar.bz2 dexon-b0ae84aa0dae65f00492f981bb61887331def2a5.tar.lz dexon-b0ae84aa0dae65f00492f981bb61887331def2a5.tar.xz dexon-b0ae84aa0dae65f00492f981bb61887331def2a5.tar.zst dexon-b0ae84aa0dae65f00492f981bb61887331def2a5.zip |
multiple contract source for solidity compiler: returns contract array if multiple contracts. fixes #1023
Diffstat (limited to 'common/compiler/solidity_test.go')
-rw-r--r-- | common/compiler/solidity_test.go | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/common/compiler/solidity_test.go b/common/compiler/solidity_test.go index 2b0ca148f..46f733e59 100644 --- a/common/compiler/solidity_test.go +++ b/common/compiler/solidity_test.go @@ -33,14 +33,18 @@ func TestCompiler(t *testing.T) { } else if sol.Version() != solcVersion { t.Logf("WARNING: a newer version of solc found (%v, expect %v)", sol.Version(), solcVersion) } - contract, err := sol.Compile(source) + contracts, err := sol.Compile(source) if err != nil { - t.Errorf("error compiling source. result %v: %v", contract, err) + t.Errorf("error compiling source. result %v: %v", contracts, err) return } - if contract.Code != code { - t.Errorf("wrong code, expected\n%s, got\n%s", code, contract.Code) + if len(contracts) != 1 { + t.Errorf("one contract expected, got\n%s", len(contracts)) + } + + if contracts["test"].Code != code { + t.Errorf("wrong code, expected\n%s, got\n%s", code, contracts["test"].Code) } } @@ -52,9 +56,9 @@ func TestCompileError(t *testing.T) { } else if sol.Version() != solcVersion { t.Logf("WARNING: a newer version of solc found (%v, expect %v)", sol.Version(), solcVersion) } - contract, err := sol.Compile(source[2:]) + contracts, err := sol.Compile(source[2:]) if err == nil { - t.Errorf("error expected compiling source. got none. result %v", contract) + t.Errorf("error expected compiling source. got none. result %v", contracts) return } } |