diff options
author | Michael Muré <batolettre@gmail.com> | 2018-07-13 16:48:55 +0200 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2018-07-13 16:48:55 +0200 |
commit | deff9e0a41eca43f832314219241c9a63cf8007e (patch) | |
tree | 215e07e7a77972cee50268603eeb3777de583e8b /bug/operation_iterator.go | |
parent | 078545538e6e6bf7a050fe6602a42a61fb5203e9 (diff) | |
download | git-bug-deff9e0a41eca43f832314219241c9a63cf8007e.tar.gz |
add basic tests for Bug and OperationIterator
Diffstat (limited to 'bug/operation_iterator.go')
-rw-r--r-- | bug/operation_iterator.go | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/bug/operation_iterator.go b/bug/operation_iterator.go index a576ddd6..fe001d45 100644 --- a/bug/operation_iterator.go +++ b/bug/operation_iterator.go @@ -16,7 +16,7 @@ func NewOperationIterator(bug *Bug) *OperationIterator { func (it *OperationIterator) Next() bool { // Special case of the staging area - if it.packIndex == len(it.bug.Packs)+1 { + if it.packIndex == len(it.bug.Packs) { pack := it.bug.Staging it.opIndex++ return it.opIndex < len(pack.Operations) @@ -39,7 +39,7 @@ func (it *OperationIterator) Next() bool { it.packIndex++ // Special case of the non-empty staging area - if it.packIndex == len(it.bug.Packs)+1 && len(it.bug.Staging.Operations) > 0 { + if it.packIndex == len(it.bug.Packs) && len(it.bug.Staging.Operations) > 0 { return true } @@ -48,7 +48,7 @@ func (it *OperationIterator) Next() bool { func (it *OperationIterator) Value() Operation { // Special case of the staging area - if it.packIndex == len(it.bug.Packs)+1 { + if it.packIndex == len(it.bug.Packs) { pack := it.bug.Staging if it.opIndex >= len(pack.Operations) { |