Skip to content
This repository was archived by the owner on Jun 14, 2018. It is now read-only.
This repository was archived by the owner on Jun 14, 2018. It is now read-only.

Feature: named enum values #35

Description

@raineorshine

Currently Solidity enums are exposed as uints:

it('should have a myEnum property', () => {
  var contract = MyContract.deployed()
  return contract.myEnum.call(accounts[0]).then(myEnumResult => {
    assert.equal(myEnumResult.valueOf(), 1)
  })
})

It would be great for ether-pudding to expose named enum values so that the tests are not tightly coupled to the enum's underlying integer values:

assert.equal(myEnumResult.valueOf(), contract.deployed().MyEnum.SomeValue)

Enums are not exposed in the ABI, so we would need to parse the source code to map enum types to integer values.


Moved from ConsenSys-archive/truffle#157 (comment)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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