X-Git-Url: https://git.arvados.org/lightning.git/blobdiff_plain/00b2acd54dd1aa412f6f2bddc24b1bbb31c7ae3f..566c65f83e443f3dfdbab2305e59db809fdb727b:/taglib_test.go diff --git a/taglib_test.go b/taglib_test.go index fbaff356da..3ab5c453e2 100644 --- a/taglib_test.go +++ b/taglib_test.go @@ -1,7 +1,12 @@ +// Copyright (C) The Lightning Authors. All rights reserved. +// +// SPDX-License-Identifier: AGPL-3.0 + package lightning import ( "bufio" + "bytes" "fmt" "io" "math/rand" @@ -41,7 +46,7 @@ gactctagcagagtggccagccac c.Assert(err, check.IsNil) haystack := []byte(`ggagaactgtgctccgccttcagaccccccccccccccccccccacacatgctagcgcgtcggggtgggggggggggggggggggggggggggactctagcagagtggccagccac`) var matches []tagMatch - taglib.FindAll(haystack, func(id tagID, pos, taglen int) { + taglib.FindAll(bufio.NewReader(bytes.NewBuffer(haystack)), nil, func(id tagID, pos, taglen int) { matches = append(matches, tagMatch{id, pos, taglen}) }) c.Check(matches, check.DeepEquals, []tagMatch{{0, 0, 24}, {1, 44, 24}, {2, 92, 24}}) @@ -86,7 +91,7 @@ func (s *taglibSuite) TestFindAllRealisticSize(c *check.C) { c.Assert(err, check.IsNil) c.Logf("@%v find tags in input", time.Since(start)) var matches []tagMatch - taglib.FindAll(haystack, func(id tagID, pos, taglen int) { + taglib.FindAll(bufio.NewReader(bytes.NewBuffer(haystack)), nil, func(id tagID, pos, taglen int) { matches = append(matches, tagMatch{id, pos, taglen}) }) c.Logf("@%v done", time.Since(start))