Merge pull request #1069 from ethereum/yann300-patch-7

Make unit testing work for solidity < 0.5.0
pull/7/head
yann300 6 years ago committed by GitHub
commit 5903766444
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      remix-tests/src/compiler.js

@ -11,11 +11,12 @@ String.prototype.regexIndexOf = function (regex, startpos) {
function writeTestAccountsContract (accounts) { function writeTestAccountsContract (accounts) {
var testAccountContract = require('../sol/tests_accounts.sol.js') var testAccountContract = require('../sol/tests_accounts.sol.js')
// TODO: this will only work for solidity 0.5.0 var body = 'address[' + accounts.length + '] memory accounts;'
var body = 'address payable[' + accounts.length + '] memory accounts'
if (!accounts.length) body += ';' if (!accounts.length) body += ';'
else { else {
body += '= [' + accounts.map((value) => { return `address(${value})` }).join(',') + '];' accounts.map((address, index) => {
body += `\naccounts[${index}] = ${address};\n`
})
} }
return testAccountContract.replace('>accounts<', body) return testAccountContract.replace('>accounts<', body)
} }

Loading…
Cancel
Save