Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 48fcea2

Browse files
authored
merkletrie: fix const action type fuck up (#268)
Action constants (Insert, Delete, Modify) have type int instead of Action. This patch make them Actions.
1 parent a69e1cf commit 48fcea2

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

utils/merkletrie/change.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ type Action int
1313

1414
// The set of possible actions in a change.
1515
const (
16-
_ = iota
16+
_ Action = iota
1717
Insert
1818
Delete
1919
Modify

utils/merkletrie/change_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ type ChangeSuite struct{}
1212

1313
var _ = Suite(&ChangeSuite{})
1414

15+
func (s *ChangeSuite) TestActionString(c *C) {
16+
action := merkletrie.Insert
17+
c.Assert(action.String(), Equals, "Insert")
18+
19+
action = merkletrie.Delete
20+
c.Assert(action.String(), Equals, "Delete")
21+
22+
action = merkletrie.Modify
23+
c.Assert(action.String(), Equals, "Modify")
24+
}
25+
1526
func (s *ChangeSuite) TestUnsupportedAction(c *C) {
1627
a := merkletrie.Action(42)
1728
c.Assert(a.String, PanicMatches, "unsupported action.*")

0 commit comments

Comments
 (0)