aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/frankban/quicktest/mapiter.go
blob: b0e2b6f21fdbc811f4496f8dc05f86c643aa3313 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Licensed under the MIT license, see LICENSE file for details.

package quicktest

import (
	"fmt"
	"reflect"
)

func newMapIter(v reflect.Value) containerIter {
	return mapIter{v.MapRange()}
}

// mapIter implements containerIter for maps.
type mapIter struct {
	iter *reflect.MapIter
}

func (i mapIter) next() bool {
	return i.iter.Next()
}

func (i mapIter) key() string {
	return fmt.Sprintf("key %#v", i.iter.Key())
}

func (i mapIter) value() reflect.Value {
	return i.iter.Value()
}