Commit 34058dbc authored by 0mkar's avatar 0mkar Committed by yann300

improve userdoc for sender account

parent add4c572
...@@ -13,7 +13,9 @@ function getFunctionFullName (signature, methodIdentifiers) { ...@@ -13,7 +13,9 @@ function getFunctionFullName (signature, methodIdentifiers) {
function getOverridedSender (userdoc, signature, methodIdentifiers) { function getOverridedSender (userdoc, signature, methodIdentifiers) {
let fullName = getFunctionFullName(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) { function getAvailableFunctions (jsonInterface) {
......
...@@ -2,25 +2,25 @@ import "remix_tests.sol"; // this import is automatically injected by Remix. ...@@ -2,25 +2,25 @@ import "remix_tests.sol"; // this import is automatically injected by Remix.
import "remix_accounts.sol"; import "remix_accounts.sol";
contract SenderTest { contract SenderTest {
function beforeAll () public {} function beforeAll () public {}
/// 1 /// sender: account-1
function checkSenderIs1 () public { function checkSenderIs1 () public {
Assert.equal(msg.sender, TestsAccounts.getAccount(1), "wrong sender in checkSenderIs1"); Assert.equal(msg.sender, TestsAccounts.getAccount(1), "wrong sender in checkSenderIs1");
} }
/// 0 /// sender: account-0
function checkSenderIs0 () public { function checkSenderIs0 () public {
Assert.equal(msg.sender, TestsAccounts.getAccount(0), "wrong sender in checkSenderIs0"); Assert.equal(msg.sender, TestsAccounts.getAccount(0), "wrong sender in checkSenderIs0");
} }
/// 1 /// sender: account-1
function checkSenderIsNt0 () public { function checkSenderIsNt0 () public {
Assert.notEqual(msg.sender, TestsAccounts.getAccount(0), "wrong sender in checkSenderIsNot0"); Assert.notEqual(msg.sender, TestsAccounts.getAccount(0), "wrong sender in checkSenderIsNot0");
} }
/// 2 /// sender: account-2
function checkSenderIsnt2 () public { function checkSenderIsnt2 () public {
Assert.notEqual(msg.sender, TestsAccounts.getAccount(1), "wrong sender in checkSenderIsnt2"); Assert.notEqual(msg.sender, TestsAccounts.getAccount(1), "wrong sender in checkSenderIsnt2");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment