improve userdoc for sender account

pull/7/head
0mkar 6 years ago committed by yann300
parent add4c57243
commit 34058dbc35
  1. 4
      remix-tests/src/testRunner.js
  2. 14
      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) {

@ -2,25 +2,25 @@ import "remix_tests.sol"; // this import is automatically injected by Remix.
import "remix_accounts.sol";
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