diff options
author | Alberto Cortés <alcortesm@gmail.com> | 2017-02-14 10:15:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-14 10:15:00 +0100 |
commit | 48fcea26a90a0e3afea13a23fa4e5e9f6a910f0b (patch) | |
tree | ec084319041020091112148fb8768f672b332690 | |
parent | a69e1cf378db9eb86fe384ced9a295b5eba7943e (diff) | |
download | go-git-48fcea26a90a0e3afea13a23fa4e5e9f6a910f0b.tar.gz |
merkletrie: fix const action type fuck up (#268)
Action constants (Insert, Delete, Modify) have type int instead of
Action. This patch make them Actions.
-rw-r--r-- | utils/merkletrie/change.go | 2 | ||||
-rw-r--r-- | utils/merkletrie/change_test.go | 11 |
2 files changed, 12 insertions, 1 deletions
diff --git a/utils/merkletrie/change.go b/utils/merkletrie/change.go index cacf658..e6c99f6 100644 --- a/utils/merkletrie/change.go +++ b/utils/merkletrie/change.go @@ -13,7 +13,7 @@ type Action int // The set of possible actions in a change. const ( - _ = iota + _ Action = iota Insert Delete Modify diff --git a/utils/merkletrie/change_test.go b/utils/merkletrie/change_test.go index c899ff9..4f908ce 100644 --- a/utils/merkletrie/change_test.go +++ b/utils/merkletrie/change_test.go @@ -12,6 +12,17 @@ type ChangeSuite struct{} var _ = Suite(&ChangeSuite{}) +func (s *ChangeSuite) TestActionString(c *C) { + action := merkletrie.Insert + c.Assert(action.String(), Equals, "Insert") + + action = merkletrie.Delete + c.Assert(action.String(), Equals, "Delete") + + action = merkletrie.Modify + c.Assert(action.String(), Equals, "Modify") +} + func (s *ChangeSuite) TestUnsupportedAction(c *C) { a := merkletrie.Action(42) c.Assert(a.String, PanicMatches, "unsupported action.*") |