Commit 516e6f6d authored by Daniel Martí's avatar Daniel Martí

all: remove some unused parameters in test code

Mostly unnecessary *testing.T arguments.

Found with github.com/mvdan/unparam.

Change-Id: Ifb955cb88f2ce8784ee4172f4f94d860fa36ae9a
Reviewed-on: https://go-review.googlesource.com/41691
Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
parent 11c7b449
...@@ -320,7 +320,7 @@ func TestScalarEncInstructions(t *testing.T) { ...@@ -320,7 +320,7 @@ func TestScalarEncInstructions(t *testing.T) {
} }
} }
func execDec(typ string, instr *decInstr, state *decoderState, t *testing.T, value reflect.Value) { func execDec(instr *decInstr, state *decoderState, t *testing.T, value reflect.Value) {
defer testError(t) defer testError(t)
v := int(state.decodeUint()) v := int(state.decodeUint())
if v+state.fieldnum != 6 { if v+state.fieldnum != 6 {
...@@ -347,7 +347,7 @@ func TestScalarDecInstructions(t *testing.T) { ...@@ -347,7 +347,7 @@ func TestScalarDecInstructions(t *testing.T) {
var data bool var data bool
instr := &decInstr{decBool, 6, nil, ovfl} instr := &decInstr{decBool, 6, nil, ovfl}
state := newDecodeStateFromData(boolResult) state := newDecodeStateFromData(boolResult)
execDec("bool", instr, state, t, reflect.ValueOf(&data)) execDec(instr, state, t, reflect.ValueOf(&data))
if data != true { if data != true {
t.Errorf("bool a = %v not true", data) t.Errorf("bool a = %v not true", data)
} }
...@@ -357,7 +357,7 @@ func TestScalarDecInstructions(t *testing.T) { ...@@ -357,7 +357,7 @@ func TestScalarDecInstructions(t *testing.T) {
var data int var data int
instr := &decInstr{decOpTable[reflect.Int], 6, nil, ovfl} instr := &decInstr{decOpTable[reflect.Int], 6, nil, ovfl}
state := newDecodeStateFromData(signedResult) state := newDecodeStateFromData(signedResult)
execDec("int", instr, state, t, reflect.ValueOf(&data)) execDec(instr, state, t, reflect.ValueOf(&data))
if data != 17 { if data != 17 {
t.Errorf("int a = %v not 17", data) t.Errorf("int a = %v not 17", data)
} }
...@@ -368,7 +368,7 @@ func TestScalarDecInstructions(t *testing.T) { ...@@ -368,7 +368,7 @@ func TestScalarDecInstructions(t *testing.T) {
var data uint var data uint
instr := &decInstr{decOpTable[reflect.Uint], 6, nil, ovfl} instr := &decInstr{decOpTable[reflect.Uint], 6, nil, ovfl}
state := newDecodeStateFromData(unsignedResult) state := newDecodeStateFromData(unsignedResult)
execDec("uint", instr, state, t, reflect.ValueOf(&data)) execDec(instr, state, t, reflect.ValueOf(&data))
if data != 17 { if data != 17 {
t.Errorf("uint a = %v not 17", data) t.Errorf("uint a = %v not 17", data)
} }
...@@ -379,7 +379,7 @@ func TestScalarDecInstructions(t *testing.T) { ...@@ -379,7 +379,7 @@ func TestScalarDecInstructions(t *testing.T) {
var data int8 var data int8
instr := &decInstr{decInt8, 6, nil, ovfl} instr := &decInstr{decInt8, 6, nil, ovfl}
state := newDecodeStateFromData(signedResult) state := newDecodeStateFromData(signedResult)
execDec("int8", instr, state, t, reflect.ValueOf(&data)) execDec(instr, state, t, reflect.ValueOf(&data))
if data != 17 { if data != 17 {
t.Errorf("int8 a = %v not 17", data) t.Errorf("int8 a = %v not 17", data)
} }
...@@ -390,7 +390,7 @@ func TestScalarDecInstructions(t *testing.T) { ...@@ -390,7 +390,7 @@ func TestScalarDecInstructions(t *testing.T) {
var data uint8 var data uint8
instr := &decInstr{decUint8, 6, nil, ovfl} instr := &decInstr{decUint8, 6, nil, ovfl}
state := newDecodeStateFromData(unsignedResult) state := newDecodeStateFromData(unsignedResult)
execDec("uint8", instr, state, t, reflect.ValueOf(&data)) execDec(instr, state, t, reflect.ValueOf(&data))
if data != 17 { if data != 17 {
t.Errorf("uint8 a = %v not 17", data) t.Errorf("uint8 a = %v not 17", data)
} }
...@@ -401,7 +401,7 @@ func TestScalarDecInstructions(t *testing.T) { ...@@ -401,7 +401,7 @@ func TestScalarDecInstructions(t *testing.T) {
var data int16 var data int16
instr := &decInstr{decInt16, 6, nil, ovfl} instr := &decInstr{decInt16, 6, nil, ovfl}
state := newDecodeStateFromData(signedResult) state := newDecodeStateFromData(signedResult)
execDec("int16", instr, state, t, reflect.ValueOf(&data)) execDec(instr, state, t, reflect.ValueOf(&data))
if data != 17 { if data != 17 {
t.Errorf("int16 a = %v not 17", data) t.Errorf("int16 a = %v not 17", data)
} }
...@@ -412,7 +412,7 @@ func TestScalarDecInstructions(t *testing.T) { ...@@ -412,7 +412,7 @@ func TestScalarDecInstructions(t *testing.T) {
var data uint16 var data uint16
instr := &decInstr{decUint16, 6, nil, ovfl} instr := &decInstr{decUint16, 6, nil, ovfl}
state := newDecodeStateFromData(unsignedResult) state := newDecodeStateFromData(unsignedResult)
execDec("uint16", instr, state, t, reflect.ValueOf(&data)) execDec(instr, state, t, reflect.ValueOf(&data))
if data != 17 { if data != 17 {
t.Errorf("uint16 a = %v not 17", data) t.Errorf("uint16 a = %v not 17", data)
} }
...@@ -423,7 +423,7 @@ func TestScalarDecInstructions(t *testing.T) { ...@@ -423,7 +423,7 @@ func TestScalarDecInstructions(t *testing.T) {
var data int32 var data int32
instr := &decInstr{decInt32, 6, nil, ovfl} instr := &decInstr{decInt32, 6, nil, ovfl}
state := newDecodeStateFromData(signedResult) state := newDecodeStateFromData(signedResult)
execDec("int32", instr, state, t, reflect.ValueOf(&data)) execDec(instr, state, t, reflect.ValueOf(&data))
if data != 17 { if data != 17 {
t.Errorf("int32 a = %v not 17", data) t.Errorf("int32 a = %v not 17", data)
} }
...@@ -434,7 +434,7 @@ func TestScalarDecInstructions(t *testing.T) { ...@@ -434,7 +434,7 @@ func TestScalarDecInstructions(t *testing.T) {
var data uint32 var data uint32
instr := &decInstr{decUint32, 6, nil, ovfl} instr := &decInstr{decUint32, 6, nil, ovfl}
state := newDecodeStateFromData(unsignedResult) state := newDecodeStateFromData(unsignedResult)
execDec("uint32", instr, state, t, reflect.ValueOf(&data)) execDec(instr, state, t, reflect.ValueOf(&data))
if data != 17 { if data != 17 {
t.Errorf("uint32 a = %v not 17", data) t.Errorf("uint32 a = %v not 17", data)
} }
...@@ -445,7 +445,7 @@ func TestScalarDecInstructions(t *testing.T) { ...@@ -445,7 +445,7 @@ func TestScalarDecInstructions(t *testing.T) {
var data uintptr var data uintptr
instr := &decInstr{decOpTable[reflect.Uintptr], 6, nil, ovfl} instr := &decInstr{decOpTable[reflect.Uintptr], 6, nil, ovfl}
state := newDecodeStateFromData(unsignedResult) state := newDecodeStateFromData(unsignedResult)
execDec("uintptr", instr, state, t, reflect.ValueOf(&data)) execDec(instr, state, t, reflect.ValueOf(&data))
if data != 17 { if data != 17 {
t.Errorf("uintptr a = %v not 17", data) t.Errorf("uintptr a = %v not 17", data)
} }
...@@ -456,7 +456,7 @@ func TestScalarDecInstructions(t *testing.T) { ...@@ -456,7 +456,7 @@ func TestScalarDecInstructions(t *testing.T) {
var data int64 var data int64
instr := &decInstr{decInt64, 6, nil, ovfl} instr := &decInstr{decInt64, 6, nil, ovfl}
state := newDecodeStateFromData(signedResult) state := newDecodeStateFromData(signedResult)
execDec("int64", instr, state, t, reflect.ValueOf(&data)) execDec(instr, state, t, reflect.ValueOf(&data))
if data != 17 { if data != 17 {
t.Errorf("int64 a = %v not 17", data) t.Errorf("int64 a = %v not 17", data)
} }
...@@ -467,7 +467,7 @@ func TestScalarDecInstructions(t *testing.T) { ...@@ -467,7 +467,7 @@ func TestScalarDecInstructions(t *testing.T) {
var data uint64 var data uint64
instr := &decInstr{decUint64, 6, nil, ovfl} instr := &decInstr{decUint64, 6, nil, ovfl}
state := newDecodeStateFromData(unsignedResult) state := newDecodeStateFromData(unsignedResult)
execDec("uint64", instr, state, t, reflect.ValueOf(&data)) execDec(instr, state, t, reflect.ValueOf(&data))
if data != 17 { if data != 17 {
t.Errorf("uint64 a = %v not 17", data) t.Errorf("uint64 a = %v not 17", data)
} }
...@@ -478,7 +478,7 @@ func TestScalarDecInstructions(t *testing.T) { ...@@ -478,7 +478,7 @@ func TestScalarDecInstructions(t *testing.T) {
var data float32 var data float32
instr := &decInstr{decFloat32, 6, nil, ovfl} instr := &decInstr{decFloat32, 6, nil, ovfl}
state := newDecodeStateFromData(floatResult) state := newDecodeStateFromData(floatResult)
execDec("float32", instr, state, t, reflect.ValueOf(&data)) execDec(instr, state, t, reflect.ValueOf(&data))
if data != 17 { if data != 17 {
t.Errorf("float32 a = %v not 17", data) t.Errorf("float32 a = %v not 17", data)
} }
...@@ -489,7 +489,7 @@ func TestScalarDecInstructions(t *testing.T) { ...@@ -489,7 +489,7 @@ func TestScalarDecInstructions(t *testing.T) {
var data float64 var data float64
instr := &decInstr{decFloat64, 6, nil, ovfl} instr := &decInstr{decFloat64, 6, nil, ovfl}
state := newDecodeStateFromData(floatResult) state := newDecodeStateFromData(floatResult)
execDec("float64", instr, state, t, reflect.ValueOf(&data)) execDec(instr, state, t, reflect.ValueOf(&data))
if data != 17 { if data != 17 {
t.Errorf("float64 a = %v not 17", data) t.Errorf("float64 a = %v not 17", data)
} }
...@@ -500,7 +500,7 @@ func TestScalarDecInstructions(t *testing.T) { ...@@ -500,7 +500,7 @@ func TestScalarDecInstructions(t *testing.T) {
var data complex64 var data complex64
instr := &decInstr{decOpTable[reflect.Complex64], 6, nil, ovfl} instr := &decInstr{decOpTable[reflect.Complex64], 6, nil, ovfl}
state := newDecodeStateFromData(complexResult) state := newDecodeStateFromData(complexResult)
execDec("complex", instr, state, t, reflect.ValueOf(&data)) execDec(instr, state, t, reflect.ValueOf(&data))
if data != 17+19i { if data != 17+19i {
t.Errorf("complex a = %v not 17+19i", data) t.Errorf("complex a = %v not 17+19i", data)
} }
...@@ -511,7 +511,7 @@ func TestScalarDecInstructions(t *testing.T) { ...@@ -511,7 +511,7 @@ func TestScalarDecInstructions(t *testing.T) {
var data complex128 var data complex128
instr := &decInstr{decOpTable[reflect.Complex128], 6, nil, ovfl} instr := &decInstr{decOpTable[reflect.Complex128], 6, nil, ovfl}
state := newDecodeStateFromData(complexResult) state := newDecodeStateFromData(complexResult)
execDec("complex", instr, state, t, reflect.ValueOf(&data)) execDec(instr, state, t, reflect.ValueOf(&data))
if data != 17+19i { if data != 17+19i {
t.Errorf("complex a = %v not 17+19i", data) t.Errorf("complex a = %v not 17+19i", data)
} }
...@@ -522,7 +522,7 @@ func TestScalarDecInstructions(t *testing.T) { ...@@ -522,7 +522,7 @@ func TestScalarDecInstructions(t *testing.T) {
var data []byte var data []byte
instr := &decInstr{decUint8Slice, 6, nil, ovfl} instr := &decInstr{decUint8Slice, 6, nil, ovfl}
state := newDecodeStateFromData(bytesResult) state := newDecodeStateFromData(bytesResult)
execDec("bytes", instr, state, t, reflect.ValueOf(&data)) execDec(instr, state, t, reflect.ValueOf(&data))
if string(data) != "hello" { if string(data) != "hello" {
t.Errorf(`bytes a = %q not "hello"`, string(data)) t.Errorf(`bytes a = %q not "hello"`, string(data))
} }
...@@ -533,7 +533,7 @@ func TestScalarDecInstructions(t *testing.T) { ...@@ -533,7 +533,7 @@ func TestScalarDecInstructions(t *testing.T) {
var data string var data string
instr := &decInstr{decString, 6, nil, ovfl} instr := &decInstr{decString, 6, nil, ovfl}
state := newDecodeStateFromData(bytesResult) state := newDecodeStateFromData(bytesResult)
execDec("bytes", instr, state, t, reflect.ValueOf(&data)) execDec(instr, state, t, reflect.ValueOf(&data))
if data != "hello" { if data != "hello" {
t.Errorf(`bytes a = %q not "hello"`, data) t.Errorf(`bytes a = %q not "hello"`, data)
} }
......
...@@ -66,7 +66,7 @@ var errRx = regexp.MustCompile(`^/\* *ERROR *(HERE)? *"([^"]*)" *\*/$`) ...@@ -66,7 +66,7 @@ var errRx = regexp.MustCompile(`^/\* *ERROR *(HERE)? *"([^"]*)" *\*/$`)
// expectedErrors collects the regular expressions of ERROR comments found // expectedErrors collects the regular expressions of ERROR comments found
// in files and returns them as a map of error positions to error messages. // in files and returns them as a map of error positions to error messages.
// //
func expectedErrors(t *testing.T, fset *token.FileSet, filename string, src []byte) map[token.Pos]string { func expectedErrors(fset *token.FileSet, filename string, src []byte) map[token.Pos]string {
errors := make(map[token.Pos]string) errors := make(map[token.Pos]string)
var s scanner.Scanner var s scanner.Scanner
...@@ -161,7 +161,7 @@ func checkErrors(t *testing.T, filename string, input interface{}) { ...@@ -161,7 +161,7 @@ func checkErrors(t *testing.T, filename string, input interface{}) {
// we are expecting the following errors // we are expecting the following errors
// (collect these after parsing a file so that it is found in the file set) // (collect these after parsing a file so that it is found in the file set)
expected := expectedErrors(t, fset, filename, src) expected := expectedErrors(fset, filename, src)
// verify errors returned by the parser // verify errors returned by the parser
compareErrors(t, fset, expected, found) compareErrors(t, fset, expected, found)
......
...@@ -17,7 +17,7 @@ import ( ...@@ -17,7 +17,7 @@ import (
const filename = "<src>" const filename = "<src>"
func makePkg(t *testing.T, src string) (*Package, error) { func makePkg(src string) (*Package, error) {
fset := token.NewFileSet() fset := token.NewFileSet()
file, err := parser.ParseFile(fset, filename, src, parser.DeclarationErrors) file, err := parser.ParseFile(fset, filename, src, parser.DeclarationErrors)
if err != nil { if err != nil {
...@@ -126,7 +126,7 @@ func TestTypeString(t *testing.T) { ...@@ -126,7 +126,7 @@ func TestTypeString(t *testing.T) {
for _, test := range tests { for _, test := range tests {
src := `package p; import "io"; type _ io.Writer; type T ` + test.src src := `package p; import "io"; type _ io.Writer; type T ` + test.src
pkg, err := makePkg(t, src) pkg, err := makePkg(src)
if err != nil { if err != nil {
t.Errorf("%s: %s", src, err) t.Errorf("%s: %s", src, err)
continue continue
......
...@@ -16,7 +16,7 @@ type image interface { ...@@ -16,7 +16,7 @@ type image interface {
SubImage(Rectangle) Image SubImage(Rectangle) Image
} }
func cmp(t *testing.T, cm color.Model, c0, c1 color.Color) bool { func cmp(cm color.Model, c0, c1 color.Color) bool {
r0, g0, b0, a0 := cm.Convert(c0).RGBA() r0, g0, b0, a0 := cm.Convert(c0).RGBA()
r1, g1, b1, a1 := cm.Convert(c1).RGBA() r1, g1, b1, a1 := cm.Convert(c1).RGBA()
return r0 == r1 && g0 == g1 && b0 == b1 && a0 == a1 return r0 == r1 && g0 == g1 && b0 == b1 && a0 == a1
...@@ -42,12 +42,12 @@ func TestImage(t *testing.T) { ...@@ -42,12 +42,12 @@ func TestImage(t *testing.T) {
t.Errorf("%T: want bounds %v, got %v", m, Rect(0, 0, 10, 10), m.Bounds()) t.Errorf("%T: want bounds %v, got %v", m, Rect(0, 0, 10, 10), m.Bounds())
continue continue
} }
if !cmp(t, m.ColorModel(), Transparent, m.At(6, 3)) { if !cmp(m.ColorModel(), Transparent, m.At(6, 3)) {
t.Errorf("%T: at (6, 3), want a zero color, got %v", m, m.At(6, 3)) t.Errorf("%T: at (6, 3), want a zero color, got %v", m, m.At(6, 3))
continue continue
} }
m.Set(6, 3, Opaque) m.Set(6, 3, Opaque)
if !cmp(t, m.ColorModel(), Opaque, m.At(6, 3)) { if !cmp(m.ColorModel(), Opaque, m.At(6, 3)) {
t.Errorf("%T: at (6, 3), want a non-zero color, got %v", m, m.At(6, 3)) t.Errorf("%T: at (6, 3), want a non-zero color, got %v", m, m.At(6, 3))
continue continue
} }
...@@ -60,16 +60,16 @@ func TestImage(t *testing.T) { ...@@ -60,16 +60,16 @@ func TestImage(t *testing.T) {
t.Errorf("%T: sub-image want bounds %v, got %v", m, Rect(3, 2, 9, 8), m.Bounds()) t.Errorf("%T: sub-image want bounds %v, got %v", m, Rect(3, 2, 9, 8), m.Bounds())
continue continue
} }
if !cmp(t, m.ColorModel(), Opaque, m.At(6, 3)) { if !cmp(m.ColorModel(), Opaque, m.At(6, 3)) {
t.Errorf("%T: sub-image at (6, 3), want a non-zero color, got %v", m, m.At(6, 3)) t.Errorf("%T: sub-image at (6, 3), want a non-zero color, got %v", m, m.At(6, 3))
continue continue
} }
if !cmp(t, m.ColorModel(), Transparent, m.At(3, 3)) { if !cmp(m.ColorModel(), Transparent, m.At(3, 3)) {
t.Errorf("%T: sub-image at (3, 3), want a zero color, got %v", m, m.At(3, 3)) t.Errorf("%T: sub-image at (3, 3), want a zero color, got %v", m, m.At(3, 3))
continue continue
} }
m.Set(3, 3, Opaque) m.Set(3, 3, Opaque)
if !cmp(t, m.ColorModel(), Opaque, m.At(3, 3)) { if !cmp(m.ColorModel(), Opaque, m.At(3, 3)) {
t.Errorf("%T: sub-image at (3, 3), want a non-zero color, got %v", m, m.At(3, 3)) t.Errorf("%T: sub-image at (3, 3), want a non-zero color, got %v", m, m.At(3, 3))
continue continue
} }
......
...@@ -409,7 +409,7 @@ func TestCopyError(t *testing.T) { ...@@ -409,7 +409,7 @@ func TestCopyError(t *testing.T) {
} }
childRunning := func() bool { childRunning := func() bool {
return isProcessRunning(t, pid) return isProcessRunning(pid)
} }
if !childRunning() { if !childRunning() {
......
...@@ -12,7 +12,7 @@ import ( ...@@ -12,7 +12,7 @@ import (
"testing" "testing"
) )
func isProcessRunning(t *testing.T, pid int) bool { func isProcessRunning(pid int) bool {
_, err := os.Stat("/proc/" + strconv.Itoa(pid)) _, err := os.Stat("/proc/" + strconv.Itoa(pid))
return err == nil return err == nil
} }
...@@ -9,10 +9,9 @@ package cgi ...@@ -9,10 +9,9 @@ package cgi
import ( import (
"os" "os"
"syscall" "syscall"
"testing"
) )
func isProcessRunning(t *testing.T, pid int) bool { func isProcessRunning(pid int) bool {
p, err := os.FindProcess(pid) p, err := os.FindProcess(pid)
if err != nil { if err != nil {
return false return false
......
...@@ -388,7 +388,7 @@ func checkMarks(t *testing.T, report bool) { ...@@ -388,7 +388,7 @@ func checkMarks(t *testing.T, report bool) {
// Assumes that each node name is unique. Good enough for a test. // Assumes that each node name is unique. Good enough for a test.
// If clear is true, any incoming error is cleared before return. The errors // If clear is true, any incoming error is cleared before return. The errors
// are always accumulated, though. // are always accumulated, though.
func mark(path string, info os.FileInfo, err error, errors *[]error, clear bool) error { func mark(info os.FileInfo, err error, errors *[]error, clear bool) error {
if err != nil { if err != nil {
*errors = append(*errors, err) *errors = append(*errors, err)
if clear { if clear {
...@@ -437,7 +437,7 @@ func TestWalk(t *testing.T) { ...@@ -437,7 +437,7 @@ func TestWalk(t *testing.T) {
errors := make([]error, 0, 10) errors := make([]error, 0, 10)
clear := true clear := true
markFn := func(path string, info os.FileInfo, err error) error { markFn := func(path string, info os.FileInfo, err error) error {
return mark(path, info, err, &errors, clear) return mark(info, err, &errors, clear)
} }
// Expect no errors. // Expect no errors.
err := filepath.Walk(tree.name, markFn) err := filepath.Walk(tree.name, markFn)
......
...@@ -53,14 +53,14 @@ func TestStopTheWorldDeadlock(t *testing.T) { ...@@ -53,14 +53,14 @@ func TestStopTheWorldDeadlock(t *testing.T) {
} }
func TestYieldProgress(t *testing.T) { func TestYieldProgress(t *testing.T) {
testYieldProgress(t, false) testYieldProgress(false)
} }
func TestYieldLockedProgress(t *testing.T) { func TestYieldLockedProgress(t *testing.T) {
testYieldProgress(t, true) testYieldProgress(true)
} }
func testYieldProgress(t *testing.T, locked bool) { func testYieldProgress(locked bool) {
c := make(chan bool) c := make(chan bool)
cack := make(chan bool) cack := make(chan bool)
go func() { go func() {
......
...@@ -18,11 +18,11 @@ func testWaitGroup(t *testing.T, wg1 *WaitGroup, wg2 *WaitGroup) { ...@@ -18,11 +18,11 @@ func testWaitGroup(t *testing.T, wg1 *WaitGroup, wg2 *WaitGroup) {
wg2.Add(n) wg2.Add(n)
exited := make(chan bool, n) exited := make(chan bool, n)
for i := 0; i != n; i++ { for i := 0; i != n; i++ {
go func(i int) { go func() {
wg1.Done() wg1.Done()
wg2.Wait() wg2.Wait()
exited <- true exited <- true
}(i) }()
} }
wg1.Wait() wg1.Wait()
for i := 0; i != n; i++ { for i := 0; i != n; i++ {
......
...@@ -498,7 +498,7 @@ func TestShutdown(t *testing.T) { ...@@ -498,7 +498,7 @@ func TestShutdown(t *testing.T) {
// We need to duplicate template.Parse here to hold on to the lexer. // We need to duplicate template.Parse here to hold on to the lexer.
const text = "erroneous{{define}}{{else}}1234" const text = "erroneous{{define}}{{else}}1234"
lexer := lex("foo", text, "{{", "}}") lexer := lex("foo", text, "{{", "}}")
_, err := New("root").parseLexer(lexer, text) _, err := New("root").parseLexer(lexer)
if err == nil { if err == nil {
t.Fatalf("expected error") t.Fatalf("expected error")
} }
...@@ -511,7 +511,7 @@ func TestShutdown(t *testing.T) { ...@@ -511,7 +511,7 @@ func TestShutdown(t *testing.T) {
// parseLexer is a local version of parse that lets us pass in the lexer instead of building it. // parseLexer is a local version of parse that lets us pass in the lexer instead of building it.
// We expect an error, so the tree set and funcs list are explicitly nil. // We expect an error, so the tree set and funcs list are explicitly nil.
func (t *Tree) parseLexer(lex *lexer, text string) (tree *Tree, err error) { func (t *Tree) parseLexer(lex *lexer) (tree *Tree, err error) {
defer t.recover(&err) defer t.recover(&err)
t.ParseName = t.Name t.ParseName = t.Name
t.startParse(nil, lex, map[string]*Tree{}) t.startParse(nil, lex, map[string]*Tree{})
......
...@@ -227,7 +227,7 @@ func TestAfterQueuing(t *testing.T) { ...@@ -227,7 +227,7 @@ func TestAfterQueuing(t *testing.T) {
err := errors.New("!=nil") err := errors.New("!=nil")
for i := 0; i < attempts && err != nil; i++ { for i := 0; i < attempts && err != nil; i++ {
delta := Duration(20+i*50) * Millisecond delta := Duration(20+i*50) * Millisecond
if err = testAfterQueuing(t, delta); err != nil { if err = testAfterQueuing(delta); err != nil {
t.Logf("attempt %v failed: %v", i, err) t.Logf("attempt %v failed: %v", i, err)
} }
} }
...@@ -247,7 +247,7 @@ func await(slot int, result chan<- afterResult, ac <-chan Time) { ...@@ -247,7 +247,7 @@ func await(slot int, result chan<- afterResult, ac <-chan Time) {
result <- afterResult{slot, <-ac} result <- afterResult{slot, <-ac}
} }
func testAfterQueuing(t *testing.T, delta Duration) error { func testAfterQueuing(delta Duration) error {
// make the result channel buffered because we don't want // make the result channel buffered because we don't want
// to depend on channel queueing semantics that might // to depend on channel queueing semantics that might
// possibly change in the future. // possibly change in the future.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment