OpenZeppelin / openzeppelin-contracts

OpenZeppelin Contracts is a library for secure smart contract development.
https://openzeppelin.com/contracts
MIT License
24.74k stars 11.75k forks source link

Properly document and maintain contract behavior test files #1085

Open nventuro opened 6 years ago

nventuro commented 6 years ago

It'd be nice if we could provide our behavior tests (e.g. Ownable) to users, so that they could in turn check that contracts inhering from those still preserve the base behavior (if applicable) and that it hasn't been accidentally broken (e.g. by overriding a modifier, etc.).

Related to #326.

frangio commented 6 years ago

They should also be properly documented, including what "arguments" they expect present in this.

frangio commented 6 years ago

Note that they are already exported.

https://github.com/OpenZeppelin/openzeppelin-solidity/blob/66c19689137b522555cab7d8a6a158c18fa443b4/package.json#L5-L8

I think this issue is more about documenting them and making sure they are usable.

frangio commented 6 years ago

Additionally, we might want to establish a rule as to what behaviors we will provide (if not for all contracts, which subset?), so that users know what to expect.

guylando commented 5 years ago

Where can one read documentation of the tests structure of openzepplin and more specifically on the difference between .behavior.js and .test.js files (for example here: https://github.com/OpenZeppelin/openzeppelin-solidity/tree/master/test/token/ERC777 the difference between ERC777.behavior.js and ERC777.test.js)?

frangio commented 5 years ago

Right now we don't have documentation for that though we're working to have something soon (#1077).

The difference is that behavior files export a function that can be reused for testing different contracts, while tests have the tests themselves, possibly using one of the behaviors.