Skip to content

Add tests for ERC20 #686

@mancze

Description

@mancze

The tests for ERC-20 token contracts does not cover all the behavior described by the actual standard. Some issues are already described in #616, but there are more. For example:

  • Testing the return values of certain functions.
  • Testing the triggered events.

Testing all the defined behavior requires lots of tests. In addition I believe having ERC-20 token thoroughly and pessimistically tested is in place. This includes testing functions with different marginal inputs and their combination (like mentioned 0x0 addresses, 0 values and like) even this leads to test duplication.

I tried to find ERC-20 testing library (and also asked). Like package with tests written to test ERC-20 compliance. Since it is a standard with defined behavior those compliance tests can be written generally for any implementation. Yet I have found nothing.

Thus I started such a package. It's aim is to test compliance with the ERC-20 token standard. Reusable tests. Even when one's token smart contract is based on some well-tested library it is beneficial to recheck. Especially when overriding functions to ensure nothing got broken.

But I think zeppelin-solidity can also benefit from it. It is easy to integrate and I have already prepared a branch mancze:test/erc20-testing for it (its a draft, not PR). Check and see. Run with:

npm test ./test/StandardToken.erc20.test.js

The token test suite still needs improvements and has some gaps. But if it makes sense it can be completed. Integrating with zeppelin-solidity would fix #616 and provide the missing tests for ERC-20 standard compliance.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions