Merge pull request #1112 from ethereum/userdocSender

improve userdoc for sender account
pull/5370/head
yann300 6 years ago committed by GitHub
commit 33a2036ccb
  1. 4
      remix-tests/src/testRunner.js
  2. 8
      remix-tests/tests/various_sender/sender_test.sol

@ -13,7 +13,9 @@ function getFunctionFullName (signature, methodIdentifiers) {
function getOverridedSender (userdoc, signature, methodIdentifiers) {
let fullName = getFunctionFullName(signature, methodIdentifiers)
return fullName && userdoc.methods[fullName] ? userdoc.methods[fullName].notice : null
let match = /sender: account-+(\d)/g
let accountIndex = userdoc.methods[fullName] ? match.exec(userdoc.methods[fullName].notice) : null
return fullName && accountIndex ? accountIndex[1] : null
}
function getAvailableFunctions (jsonInterface) {

@ -5,22 +5,22 @@ contract SenderTest {
function beforeAll () public {}
/// 1
/// sender: account-1
function checkSenderIs1 () public {
Assert.equal(msg.sender, TestsAccounts.getAccount(1), "wrong sender in checkSenderIs1");
}
/// 0
/// sender: account-0
function checkSenderIs0 () public {
Assert.equal(msg.sender, TestsAccounts.getAccount(0), "wrong sender in checkSenderIs0");
}
/// 1
/// sender: account-1
function checkSenderIsNt0 () public {
Assert.notEqual(msg.sender, TestsAccounts.getAccount(0), "wrong sender in checkSenderIsNot0");
}
/// 2
/// sender: account-2
function checkSenderIsnt2 () public {
Assert.notEqual(msg.sender, TestsAccounts.getAccount(1), "wrong sender in checkSenderIsnt2");
}

Loading…
Cancel
Save