this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

internal: remove cuetest.Chunker

This was only used by the kubernetes tutorial
deleted in mid 2024.

Remove cuetxtar.EvalV2 while here too, as it's also unused now.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: I6949f4ae1ed741654c514ec871f057d120d3d0d4
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1235343
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Roger Peppe <rogpeppe@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>

-79
-73
internal/cuetest/chunker.go
··· 1 - // Copyright 2019 CUE Authors 2 - // 3 - // Licensed under the Apache License, Version 2.0 (the "License"); 4 - // you may not use this file except in compliance with the License. 5 - // You may obtain a copy of the License at 6 - // 7 - // http://www.apache.org/licenses/LICENSE-2.0 8 - // 9 - // Unless required by applicable law or agreed to in writing, software 10 - // distributed under the License is distributed on an "AS IS" BASIS, 11 - // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 - // See the License for the specific language governing permissions and 13 - // limitations under the License. 14 - 15 - package cuetest 16 - 17 - import ( 18 - "bytes" 19 - "testing" 20 - ) 21 - 22 - // A Chunker is used to find segments in text. 23 - type Chunker struct { 24 - t *testing.T 25 - b []byte 26 - s []byte 27 - p int 28 - } 29 - 30 - // NewChunker returns a new chunker. 31 - func NewChunker(t *testing.T, b []byte) *Chunker { 32 - return &Chunker{t: t, b: b} 33 - } 34 - 35 - // Next finds the first occurrence from the current scan position of beg, 36 - // records the segment from that position until the first occurrence of end 37 - // and then updates the current position. It reports whether a segment enclosed 38 - // by beg and end can be found. 39 - func (c *Chunker) Next(beg, end string) bool { 40 - if !c.Find(beg) { 41 - return false 42 - } 43 - if !c.Find(end) { 44 - c.t.Fatalf("quotes at position %d not terminated", c.p) 45 - } 46 - return true 47 - } 48 - 49 - // Text returns the text segment captured by the last call to Next or Find. 50 - func (c *Chunker) Text() string { 51 - return string(c.s) 52 - } 53 - 54 - // Bytes returns the segment captured by the last call to Next or Find. 55 - func (c *Chunker) Bytes() []byte { 56 - return c.s 57 - } 58 - 59 - // Find searches for key from the current position and sets the current segment 60 - // to the text from current position up till the key's position. If successful, 61 - // the position is updated to point directly after the occurrence of key. 62 - func (c *Chunker) Find(key string) bool { 63 - p := bytes.Index(c.b, []byte(key)) 64 - if p == -1 { 65 - c.s = c.b 66 - return false 67 - } 68 - c.p += p + len(key) 69 - b := c.b 70 - c.s = b[:p] 71 - c.b = b[p+len(key):] 72 - return true 73 - }
-6
internal/cuetxtar/txtar.go
··· 46 46 "golang.org/x/tools/txtar" 47 47 ) 48 48 49 - // We are removing any references to evalv2 in the testing infrastructure. 50 - // However, in the evaluator test, we will keep the evalv2 outputs around for 51 - // a while to be able to compare the outputs of the two versions. 52 - // TODO: at some point we should promote evalv3 to the default version. 53 - const EvalV2 = "v2" 54 - 55 49 // A TxTarTest represents a test run that process all CUE tests in the txtar 56 50 // format rooted in a given directory. See the [Test] documentation for 57 51 // more details.