diff options
author | zelig <viktor.tron@gmail.com> | 2015-05-18 22:31:26 +0800 |
---|---|---|
committer | zelig <viktor.tron@gmail.com> | 2015-05-20 09:47:13 +0800 |
commit | f9abcee0f9185d41c71cc24af1303133497ebeb0 (patch) | |
tree | 7e33bf08ba0a501257dcbf3bc4c5d2ab55b7ad11 /rpc | |
parent | 79042223dc5f2ae5d4a2ed73d18907440a963093 (diff) | |
download | dexon-f9abcee0f9185d41c71cc24af1303133497ebeb0.tar dexon-f9abcee0f9185d41c71cc24af1303133497ebeb0.tar.gz dexon-f9abcee0f9185d41c71cc24af1303133497ebeb0.tar.bz2 dexon-f9abcee0f9185d41c71cc24af1303133497ebeb0.tar.lz dexon-f9abcee0f9185d41c71cc24af1303133497ebeb0.tar.xz dexon-f9abcee0f9185d41c71cc24af1303133497ebeb0.tar.zst dexon-f9abcee0f9185d41c71cc24af1303133497ebeb0.zip |
fix solc tests unskip
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/api_test.go | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/rpc/api_test.go b/rpc/api_test.go index b49e27bd1..263e9666d 100644 --- a/rpc/api_test.go +++ b/rpc/api_test.go @@ -30,12 +30,15 @@ func TestWeb3Sha3(t *testing.T) { } } +const solcVersion = "0.9.23" + func TestCompileSolidity(t *testing.T) { - t.Skip() solc, err := compiler.New("") if solc == nil { - t.Skip("no solidity compiler") + t.Skip("no solc found: skip") + } else if solc.Version() != solcVersion { + t.Logf("WARNING: solc different version found (%v, test written for %v, may need to update)", solc.Version(), solcVersion) } source := `contract test {\n` + " /// @notice Will multiply `a` by 7." + `\n` + @@ -46,11 +49,11 @@ func TestCompileSolidity(t *testing.T) { jsonstr := `{"jsonrpc":"2.0","method":"eth_compileSolidity","params":["` + source + `"],"id":64}` - //expCode := "605280600c6000396000f3006000357c010000000000000000000000000000000000000000000000000000000090048063c6888fa114602e57005b60376004356041565b8060005260206000f35b6000600782029050604d565b91905056" + expCode := "0x605880600c6000396000f3006000357c010000000000000000000000000000000000000000000000000000000090048063c6888fa114602e57005b603d6004803590602001506047565b8060005260206000f35b60006007820290506053565b91905056" expAbiDefinition := `[{"constant":false,"inputs":[{"name":"a","type":"uint256"}],"name":"multiply","outputs":[{"name":"d","type":"uint256"}],"type":"function"}]` expUserDoc := `{"methods":{"multiply(uint256)":{"notice":"Will multiply ` + "`a`" + ` by 7."}}}` expDeveloperDoc := `{"methods":{}}` - expCompilerVersion := `0.9.13` + expCompilerVersion := solc.Version() expLanguage := "Solidity" expLanguageVersion := "0" expSource := source @@ -76,11 +79,10 @@ func TestCompileSolidity(t *testing.T) { t.Errorf("expected no error, got %v", err) } - /* - if contract.Code != expCode { - t.Errorf("Expected %s got %s", expCode, contract.Code) - } - */ + if contract.Code != expCode { + t.Errorf("Expected \n%s got \n%s", expCode, contract.Code) + } + if strconv.Quote(contract.Info.Source) != `"`+expSource+`"` { t.Errorf("Expected \n'%s' got \n'%s'", expSource, strconv.Quote(contract.Info.Source)) } |