Added message string for require() (#1704)

* Error handling in ERC20 and ERC721

* Added message string for require.

* Fixed solhint errors.

* Updated PR as per issue #1709

* changes as per #1709 and openzeppelin forum.

* Changes in require statement

* Changes in require statement

* build pipeline fix

* Changes as per @nventuro's comment.

* Update revert reason strings.

* Fianal update of revert reason strings.

* WIP: Updating reason strings in test cases

* WIP: Added changes to ERC20 and ERC721

* Fixes linting errors in *.tes.js files

* Achieved 100% code coverage

* Updated the test cases with shouldFail.reverting.withMessage()

* Fix package-lock.

* address review comments

* fix linter issues

* fix remaining revert reasons
This commit is contained in:
Balaji Pachai
2019-04-24 19:47:08 +05:30
committed by Nicolás Venturo
parent 4a0a67b04c
commit 3682c6575c
93 changed files with 769 additions and 423 deletions

View File

@ -9,7 +9,7 @@ contract('Roles', function ([_, authorized, otherAuthorized, other]) {
});
it('reverts when querying roles for the zero account', async function () {
await shouldFail.reverting(this.roles.has(ZERO_ADDRESS));
await shouldFail.reverting.withMessage(this.roles.has(ZERO_ADDRESS), 'Roles: account is the zero address');
});
context('initially', function () {
@ -28,11 +28,11 @@ contract('Roles', function ([_, authorized, otherAuthorized, other]) {
it('reverts when adding roles to an already assigned account', async function () {
await this.roles.add(authorized);
await shouldFail.reverting(this.roles.add(authorized));
await shouldFail.reverting.withMessage(this.roles.add(authorized), 'Roles: account already has role');
});
it('reverts when adding roles to the zero account', async function () {
await shouldFail.reverting(this.roles.add(ZERO_ADDRESS));
await shouldFail.reverting.withMessage(this.roles.add(ZERO_ADDRESS), 'Roles: account is the zero address');
});
});
});
@ -51,11 +51,11 @@ contract('Roles', function ([_, authorized, otherAuthorized, other]) {
});
it('reverts when removing unassigned roles', async function () {
await shouldFail.reverting(this.roles.remove(other));
await shouldFail.reverting.withMessage(this.roles.remove(other), 'Roles: account does not have role');
});
it('reverts when removing roles from the zero account', async function () {
await shouldFail.reverting(this.roles.remove(ZERO_ADDRESS));
await shouldFail.reverting.withMessage(this.roles.remove(ZERO_ADDRESS), 'Roles: account is the zero address');
});
});
});