From b2b8a0cb11395efa52e4bb4c044271e6eae71afc Mon Sep 17 00:00:00 2001 From: Liana Husikyan Date: Thu, 15 Nov 2018 11:30:41 +0100 Subject: [PATCH] fixes tests --- remix-lib/package.json | 2 +- remix-lib/test/sourceMappingDecoder.js | 4 +-- remix-lib/test/txFormat.js | 45 +++++++++++++------------- 3 files changed, 25 insertions(+), 26 deletions(-) diff --git a/remix-lib/package.json b/remix-lib/package.json index b4aa95f968..648100b19e 100644 --- a/remix-lib/package.json +++ b/remix-lib/package.json @@ -27,7 +27,7 @@ "ethereumjs-vm": "^2.3.3", "ethers": "^3.0.15", "fast-async": "^6.1.2", - "solc": "^0.4.13", + "solc": "^0.5.0", "standard": "^7.0.1", "tape": "^4.6.0", "web3": "0.20.6" diff --git a/remix-lib/test/sourceMappingDecoder.js b/remix-lib/test/sourceMappingDecoder.js index e7b9a8ea64..5be0348132 100644 --- a/remix-lib/test/sourceMappingDecoder.js +++ b/remix-lib/test/sourceMappingDecoder.js @@ -107,12 +107,12 @@ tape('SourceMappingDecoder', function (t) { }) var contracts = `contract test { - function f1() returns (uint) { + function f1() public returns (uint) { uint t = 4; return t; } - function f2() { + function f2() public { } } diff --git a/remix-lib/test/txFormat.js b/remix-lib/test/txFormat.js index 0dabd5f34e..c8192ed80b 100644 --- a/remix-lib/test/txFormat.js +++ b/remix-lib/test/txFormat.js @@ -15,7 +15,7 @@ tape('ContractParameters - (TxFormat.buildData) - format input parameters', func output = JSON.parse(output) var contract = output.contracts['test.sol']['uintContractTest'] context = { output, contract } - var bytecode = '608060405234801561001057600080fd5b50610111806100206000396000f300608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680634b521953146044575b600080fd5b348015604f57600080fd5b50609660048036038101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001909291905050506098565b005b8260008190555081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050505600a165627a7a7230582028c4b7d4bd450fb198ccfdf15510df1721e4f8abda2487d4b452c533bed8880b0029' + var bytecode = '608060405234801561001057600080fd5b5061011e806100206000396000f3fe608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680634b521953146044575b600080fd5b348015604f57600080fd5b5060a360048036036060811015606457600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505060a5565b005b8260008190555081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505056fea165627a7a7230582053a6bee96a62b9079722b2a0004a405aa29803abc12ed6dd0322007ebb44a5f60029' t.test('(TxFormat.buildData)', function (st) { st.plan(3) testWithInput(st, '123123, "0xf7a10e525d4b168f45f74db1b61f63d3e7619ea8", "34"', bytecode + '000000000000000000000000000000000000000000000000000000000001e0f3000000000000000000000000f7a10e525d4b168f45f74db1b61f63d3e7619ea80000000000000000000000000000000000000000000000000000000000000022') @@ -29,7 +29,7 @@ function testWithInput (st, params, expected) { txFormat.buildData('uintContractTest', context.contract, context.output.contracts, true, context.contract.abi[0], params, (error, data) => { if (error) { return st.fails(error) } console.log(data) - st.equal(data.dataHex, expected) + st.equal(expected, data.dataHex) }, () => {}, () => {}) } @@ -96,7 +96,8 @@ function testLinkLibrary2 (st, callbackDeployLibraries) { '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': '0xf7a10e525d4b168f45f74db1b61f63d3e7619e33' } } - var data = '608060405234801561001057600080fd5b5061026b806100206000396000f300608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680636d4ce63c14610046575b600080fd5b34801561005257600080fd5b5061005b61005d565b005b73f7a10e525d4b168f45f74db1b61f63d3e7619e116344733ae16040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b1580156100bd57600080fd5b505af41580156100d1573d6000803e3d6000fd5b5050505073f7a10e525d4b168f45f74db1b61f63d3e7619e336344733ae16040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b15801561013557600080fd5b505af4158015610149573d6000803e3d6000fd5b5050505073f7a10e525d4b168f45f74db1b61f63d3e7619e336344733ae16040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b1580156101ad57600080fd5b505af41580156101c1573d6000803e3d6000fd5b5050505073f7a10e525d4b168f45f74db1b61f63d3e7619e116344733ae16040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b15801561022557600080fd5b505af4158015610239573d6000803e3d6000fd5b505050505600a165627a7a7230582007a22a440570c53944d704e68b3fd4ba3ba4a0fba71c4abd66b195d87f065bcd0029' + + var data = '608060405234801561001057600080fd5b5061026b806100206000396000f3fe608060405260043610610041576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680636d4ce63c14610046575b600080fd5b34801561005257600080fd5b5061005b61005d565b005b73f7a10e525d4b168f45f74db1b61f63d3e7619e116344733ae16040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b1580156100bd57600080fd5b505af41580156100d1573d6000803e3d6000fd5b5050505073f7a10e525d4b168f45f74db1b61f63d3e7619e336344733ae16040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b15801561013557600080fd5b505af4158015610149573d6000803e3d6000fd5b5050505073f7a10e525d4b168f45f74db1b61f63d3e7619e336344733ae16040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b1580156101ad57600080fd5b505af41580156101c1573d6000803e3d6000fd5b5050505073f7a10e525d4b168f45f74db1b61f63d3e7619e116344733ae16040518163ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040160006040518083038186803b15801561022557600080fd5b505af4158015610239573d6000803e3d6000fd5b5050505056fea165627a7a72305820d2fdcf2968ba13c89dd82748af1cac609a670e333fce635bc2212c2a50508be70029' 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...'] @@ -216,26 +217,26 @@ tape('test abiEncoderV2 array of tuple', function (t) { var uintContract = `contract uintContractTest { uint _tp; address _ap; - function test(uint _t, address _a, uint _i) { + function test(uint _t, address _a, uint _i) public { _tp = _t; _ap = _a; } }` -var deploySimpleLib = `pragma solidity ^0.4.4; +var deploySimpleLib = `pragma solidity ^0.5.0; library lib1 { - function getEmpty () { + function getEmpty () public { } } library 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 { - function getEmpty () { + function getEmpty () public { } } contract testContractLinkLibrary { - function get () { + function get () public { 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(); @@ -243,22 +244,20 @@ contract testContractLinkLibrary { } }` -var encodeFunctionCall = `pragma solidity ^0.4.4; +var encodeFunctionCall = `pragma solidity ^0.5.0; contract testContractLinkLibrary { - function get (uint _p, string _o) { - - } + function get (uint _p, string memory _o) public { + } }` -var fallbackFunction = `pragma solidity ^0.4.4; +var fallbackFunction = `pragma solidity ^0.5.0; contract fallbackFunctionContract { - function get (uint _p, string _o) { - + function get (uint _p, string memory _o) public { } - function () {} + function () external {} }` var abiEncoderV2 = `pragma experimental ABIEncoderV2; @@ -269,12 +268,12 @@ contract test { uint b; string s; } - function t (p _p, uint _i) returns (p) { + function t (p memory _p, uint _i) public returns (p memory) { return _p; } - function t () returns (p) { - p mm; + function t () public returns (p memory) { + p memory mm; mm.a = 123; mm.b = 133; return mm; @@ -284,17 +283,17 @@ contract test { var abiEncoderV2ArrayOfTuple = `pragma experimental ABIEncoderV2; contract test { - struct MyStruct {uint256 num; string _string;} + struct MyStruct {uint256 num; string _string;} - constructor (MyStruct[] _structs, string _str) { + constructor (MyStruct[] memory _structs, string memory _str) public { } - function addStructs(MyStruct[] _structs) public returns (MyStruct[] strucmts) { + function addStructs(MyStruct[] memory _structs) public returns (MyStruct[] memory strucmts) { strucmts = _structs; } - function addStructs(MyStruct _structs) public returns (MyStruct _strucmts) { + function addStructs(MyStruct memory _structs) public returns (MyStruct memory _strucmts) { _strucmts = _structs; } }`