return h.Do()
}
-func sliceIter(skeys [][]byte) SecretKeyIter {
- return func(callback func([]byte) bool) {
- for _, sk := range skeys {
- if !callback(sk) {
- break
- }
- }
- }
-}
-
// A function that given a function, calls it with secret keys until it
// returns false or exhausted.
type SecretKeyIter func(callback func(skey []byte) (more bool))
"github.com/stretchr/testify/require"
)
+func sliceIter(skeys [][]byte) SecretKeyIter {
+ return func(callback func([]byte) bool) {
+ for _, sk := range skeys {
+ if !callback(sk) {
+ break
+ }
+ }
+ }
+}
+
func TestReadUntil(t *testing.T) {
test := func(data, until string, leftover int, expectedErr error) {
r := bytes.NewReader([]byte(data))