@@ -226,7 +226,7 @@ func TestCapture(t *testing.T) {
226226 _ = testCases
227227 for _ , tc := range testCases {
228228 state , assert := tc .setup ()
229- if matches , _ := Match (state , codeAndValueList ( tc .parts ) ); ! matches {
229+ if matches , _ := Match (state , tc .parts ); ! matches {
230230 t .Fatalf ("failed to match %v with %v" , tc .parts , state )
231231 }
232232 assert ()
@@ -235,7 +235,7 @@ func TestCapture(t *testing.T) {
235235
236236func TestPreferExactOverAny (t * testing.T ) {
237237 t .Run ("Optional" , func (t * testing.T ) {
238- m := codeAndValueList {
238+ m := [] codeAndValue {
239239 {0 , "hello" },
240240 {1 , "foo" },
241241 {42 , "A" },
@@ -260,7 +260,7 @@ func TestPreferExactOverAny(t *testing.T) {
260260 })
261261
262262 t .Run ("Or" , func (t * testing.T ) {
263- m := codeAndValueList {
263+ m := [] codeAndValue {
264264 {1 , "foo" },
265265 {42 , "A" },
266266 {42 , "B" },
@@ -282,7 +282,7 @@ func TestPreferExactOverAny(t *testing.T) {
282282 }
283283 })
284284 t .Run ("OneOrMore" , func (t * testing.T ) {
285- m := codeAndValueList {
285+ m := [] codeAndValue {
286286 {1 , "foo" },
287287 {42 , "A" },
288288 {42 , "B" },
@@ -305,7 +305,7 @@ func TestPreferExactOverAny(t *testing.T) {
305305}
306306
307307func TestCaptureWithAny (t * testing.T ) {
308- m := codeAndValueList {
308+ m := [] codeAndValue {
309309 {0 , "hello" },
310310 {1 , "foo" },
311311 {42 , "A" },
@@ -334,25 +334,15 @@ func TestCaptureWithAny(t *testing.T) {
334334 }
335335}
336336
337- type codeAndValueList []codeAndValue
338-
339- func (c codeAndValueList ) Get (i int ) Matchable {
340- return & c [i ]
341- }
342-
343- func (c codeAndValueList ) Len () int {
344- return len (c )
345- }
346-
347- func codesToCodeAndValue (codes []int ) codeAndValueList {
337+ func codesToCodeAndValue (codes []int ) []codeAndValue {
348338 out := make ([]codeAndValue , len (codes ))
349339 for i , c := range codes {
350340 out [i ] = codeAndValue {code : c }
351341 }
352342 return out
353343}
354344
355- func bytesToCodeAndValue (codes []byte ) codeAndValueList {
345+ func bytesToCodeAndValue (codes []byte ) [] codeAndValue {
356346 out := make ([]codeAndValue , len (codes ))
357347 for i , c := range codes {
358348 out [i ] = codeAndValue {code : int (c )}
0 commit comments