Support for legacy version 0.9.x is gone. The compiler version is no
longer cached. Compilation results (and the version) are read directly
from stdout using the --combined-json flag. As a workaround for
ethereum/solidity#651, source code is written to a temporary file before
compilation.
Integration of solc in package ethapi and cmd/abigen is now much simpler
because the compiler wrapper is no longer passed around as a pointer.
Fixes#2806, accidentally
info=`{"source":"\ncontract test {\n /// @notice Will multiply `+"`a`"+` by 7.\n function multiply(uint a) returns(uint d) {\n return a * 7;\n }\n}\n","language":"Solidity","languageVersion":"0.1.1","compilerVersion":"0.1.1","compilerOptions":"--binary file --json-abi file --natspec-user file --natspec-dev file --add-std 1","abiDefinition":[{"constant":false,"inputs":[{"name":"a","type":"uint256"}],"name":"multiply","outputs":[{"name":"d","type":"uint256"}],"type":"function"}],"userDoc":{"methods":{"multiply(uint256)":{"notice":"Will multiply `+"`a`"+` by 7."}}},"developerDoc":{"methods":{}}}`
testInfo=`{"source":"\ncontract test {\n /// @notice Will multiply `+"`a`"+` by 7.\n function multiply(uint a) returns(uint d) {\n return a * 7;\n }\n}\n","language":"Solidity","languageVersion":"0.1.1","compilerVersion":"0.1.1","compilerOptions":"--binary file --json-abi file --natspec-user file --natspec-dev file --add-std 1","abiDefinition":[{"constant":false,"inputs":[{"name":"a","type":"uint256"}],"name":"multiply","outputs":[{"name":"d","type":"uint256"}],"type":"function"}],"userDoc":{"methods":{"multiply(uint256)":{"notice":"Will multiply `+"`a`"+` by 7."}}},"developerDoc":{"methods":{}}}`
)
funcTestCompiler(t*testing.T){
sol,err:=New("")
funcskipUnsupported(t*testing.T){
sol,err:=SolidityVersion("")
iferr!=nil{
t.Skipf("solc not found: %v",err)
}elseifsol.Version()!=solcVersion{
t.Skipf("WARNING: a newer version of solc found (%v, expect %v)",sol.Version(),solcVersion)
}
contracts,err:=sol.Compile(source)
iferr!=nil{
t.Errorf("error compiling source. result %v: %v",contracts,err)
t.Skip(err)
return
}
ifsol.Version!=supportedSolcVersion{
t.Skipf("unsupported version of solc found (%v, expect %v)",sol.Version,supportedSolcVersion)