Merge pull request #1095 from ethereum/fix_remix_lib

fix txFormat tests
pull/7/head
yann300 6 years ago committed by GitHub
commit 56b1067f73
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 25
      remix-lib/test/txFormat.js

@ -15,7 +15,8 @@ tape('ContractParameters - (TxFormat.buildData) - format input parameters', func
output = JSON.parse(output) output = JSON.parse(output)
var contract = output.contracts['test.sol']['uintContractTest'] var contract = output.contracts['test.sol']['uintContractTest']
context = { output, contract } context = { output, contract }
var bytecode = '608060405234801561001057600080fd5b5061011e806100206000396000f3fe608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680634b521953146044575b600080fd5b348015604f57600080fd5b5060a360048036036060811015606457600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505060a5565b005b8260008190555081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505056fea165627a7a7230582053a6bee96a62b9079722b2a0004a405aa29803abc12ed6dd0322007ebb44a5f60029' var bytecode = '608060405234801561001057600080fd5b50610118806100206000396000f3fe6080604052600436106039576000357c0100000000000000000000000000000000000000000000000000000000900480634b52195314603e575b600080fd5b348015604957600080fd5b50609d60048036036060811015605e57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050609f565b005b8260008190555081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505056fea165627a7a72305820eef04af1d305b2d1a4227d962175cf0c1ddc8c5a50f11189b73615d73344a0270029'
t.test('(TxFormat.buildData)', function (st) { t.test('(TxFormat.buildData)', function (st) {
st.plan(3) st.plan(3)
testWithInput(st, '123123, "0xf7a10e525d4b168f45f74db1b61f63d3e7619ea8", "34"', bytecode + '000000000000000000000000000000000000000000000000000000000001e0f3000000000000000000000000f7a10e525d4b168f45f74db1b61f63d3e7619ea80000000000000000000000000000000000000000000000000000000000000022') testWithInput(st, '123123, "0xf7a10e525d4b168f45f74db1b61f63d3e7619ea8", "34"', bytecode + '000000000000000000000000000000000000000000000000000000000001e0f3000000000000000000000000f7a10e525d4b168f45f74db1b61f63d3e7619ea80000000000000000000000000000000000000000000000000000000000000022')
@ -97,7 +98,7 @@ function testLinkLibrary2 (st, callbackDeployLibraries) {
} }
} }
var data = '608060405234801561001057600080fd5b5061026b806100206000396000f3fe608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680636d4ce63c14610046575b600080fd5b34801561005257600080fd5b5061005b61005d565b005b73f7a10e525d4b168f45f74db1b61f63d3e7619e116344733ae16040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b1580156100bd57600080fd5b505af41580156100d1573d6000803e3d6000fd5b5050505073f7a10e525d4b168f45f74db1b61f63d3e7619e336344733ae16040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b15801561013557600080fd5b505af4158015610149573d6000803e3d6000fd5b5050505073f7a10e525d4b168f45f74db1b61f63d3e7619e336344733ae16040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b1580156101ad57600080fd5b505af41580156101c1573d6000803e3d6000fd5b5050505073f7a10e525d4b168f45f74db1b61f63d3e7619e116344733ae16040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b15801561022557600080fd5b505af4158015610239573d6000803e3d6000fd5b5050505056fea165627a7a72305820d2fdcf2968ba13c89dd82748af1cac609a670e333fce635bc2212c2a50508be70029' var data = '608060405234801561001057600080fd5b50610265806100206000396000f3fe60806040526004361061003b576000357c0100000000000000000000000000000000000000000000000000000000900480636d4ce63c14610040575b600080fd5b34801561004c57600080fd5b50610055610057565b005b73f7a10e525d4b168f45f74db1b61f63d3e7619e116344733ae16040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b1580156100b757600080fd5b505af41580156100cb573d6000803e3d6000fd5b5050505073f7a10e525d4b168f45f74db1b61f63d3e7619e336344733ae16040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b15801561012f57600080fd5b505af4158015610143573d6000803e3d6000fd5b5050505073f7a10e525d4b168f45f74db1b61f63d3e7619e336344733ae16040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b1580156101a757600080fd5b505af41580156101bb573d6000803e3d6000fd5b5050505073f7a10e525d4b168f45f74db1b61f63d3e7619e116344733ae16040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b15801561021f57600080fd5b505af4158015610233573d6000803e3d6000fd5b5050505056fea165627a7a7230582056535474e1f8ba4f728b0d6fff8855d02828ff110ccef98edd3965c6c2a9a4b10029'
var deployMsg = ['creation of library test.sol:lib1 pending...', var deployMsg = ['creation of library test.sol:lib1 pending...',
'creation of library test.sol:lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2 pending...'] 'creation of library test.sol:lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2 pending...']
@ -235,7 +236,7 @@ library lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_li
} }
} }
contract testContractLinkLibrary { contract testContractLinkLibrary {
function get () public { function get () public {
lib1.getEmpty(); lib1.getEmpty();
lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2.getEmpty(); lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2_lib2.getEmpty();
@ -246,17 +247,17 @@ contract testContractLinkLibrary {
var encodeFunctionCall = `pragma solidity ^0.5.0; var encodeFunctionCall = `pragma solidity ^0.5.0;
contract testContractLinkLibrary { contract testContractLinkLibrary {
function get (uint _p, string memory _o) public { function get (uint _p, string memory _o) public {
} }
}` }`
var fallbackFunction = `pragma solidity ^0.5.0; var fallbackFunction = `pragma solidity ^0.5.0;
contract fallbackFunctionContract { contract fallbackFunctionContract {
function get (uint _p, string memory _o) public { function get (uint _p, string memory _o) public {
} }
function () external {} function () external {}
}` }`
@ -271,7 +272,7 @@ contract test {
function t (p memory _p, uint _i) public returns (p memory) { function t (p memory _p, uint _i) public returns (p memory) {
return _p; return _p;
} }
function t () public returns (p memory) { function t () public returns (p memory) {
p memory mm; p memory mm;
mm.a = 123; mm.a = 123;
@ -282,17 +283,17 @@ contract test {
var abiEncoderV2ArrayOfTuple = `pragma experimental ABIEncoderV2; var abiEncoderV2ArrayOfTuple = `pragma experimental ABIEncoderV2;
contract test { contract test {
struct MyStruct {uint256 num; string _string;} struct MyStruct {uint256 num; string _string;}
constructor (MyStruct[] memory _structs, string memory _str) public { constructor (MyStruct[] memory _structs, string memory _str) public {
} }
function addStructs(MyStruct[] memory _structs) public returns (MyStruct[] memory strucmts) { function addStructs(MyStruct[] memory _structs) public returns (MyStruct[] memory strucmts) {
strucmts = _structs; strucmts = _structs;
} }
function addStructs(MyStruct memory _structs) public returns (MyStruct memory _strucmts) { function addStructs(MyStruct memory _structs) public returns (MyStruct memory _strucmts) {
_strucmts = _structs; _strucmts = _structs;
} }

Loading…
Cancel
Save