Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Events logs really interesting even when tests pass. #186

@HCharlanes

Description

@HCharlanes

Truffle shows events shot by a contract when its test fail. That is really a cool feature that may be interesting even when tests successfully pass.

I personally use Events to understand better how my contract behaves while testing them. For instance:

event Test(uint testID);
​
function someFunction (address addr, uint _uint) returns (bool) {
        if (a)  { Test(111); return false;}
        if(b)) {Test(112); return false;}   
[...] }

// or 
    for (uint i=0; i<n; i++) {
            if (a(i)) {Test(i); return false;}
        }

I'm currently adding a assert.equal(1,2) at the end to have access to those events, but might be an interesting feature to have.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions