mirror of
https://github.com/golang/go
synced 2024-11-18 08:14:41 -07:00
cmd/asm: use strings.Builder
Change-Id: I2ec419f475f9c5d5ef1d4557cb5862a55a699d9c Reviewed-on: https://go-review.googlesource.com/c/go/+/428284 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Keith Randall <khr@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
This commit is contained in:
parent
596b0d0410
commit
cf4edac16e
@ -5,9 +5,9 @@
|
||||
package asm
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"strconv"
|
||||
"strings"
|
||||
"text/scanner"
|
||||
|
||||
"cmd/asm/internal/arch"
|
||||
@ -22,7 +22,7 @@ import (
|
||||
|
||||
// TODO: configure the architecture
|
||||
|
||||
var testOut *bytes.Buffer // Gathers output when testing.
|
||||
var testOut *strings.Builder // Gathers output when testing.
|
||||
|
||||
// append adds the Prog to the end of the program-thus-far.
|
||||
// If doLabel is set, it also defines the labels collect for this Prog.
|
||||
|
@ -34,7 +34,7 @@ func testEndToEnd(t *testing.T, goarch, file string) {
|
||||
parser := NewParser(ctxt, architecture, lexer, false)
|
||||
pList := new(obj.Plist)
|
||||
var ok bool
|
||||
testOut = new(bytes.Buffer) // The assembler writes test output to this buffer.
|
||||
testOut = new(strings.Builder) // The assembler writes test output to this buffer.
|
||||
ctxt.Bso = bufio.NewWriter(os.Stdout)
|
||||
ctxt.IsAsm = true
|
||||
defer ctxt.Bso.Flush()
|
||||
@ -277,7 +277,7 @@ func testErrors(t *testing.T, goarch, file string, flags ...string) {
|
||||
parser := NewParser(ctxt, architecture, lexer, false)
|
||||
pList := new(obj.Plist)
|
||||
var ok bool
|
||||
testOut = new(bytes.Buffer) // The assembler writes test output to this buffer.
|
||||
testOut = new(strings.Builder) // The assembler writes test output to this buffer.
|
||||
ctxt.Bso = bufio.NewWriter(os.Stdout)
|
||||
ctxt.IsAsm = true
|
||||
defer ctxt.Bso.Flush()
|
||||
|
@ -5,7 +5,6 @@
|
||||
package asm
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@ -81,7 +80,7 @@ func TestErroneous(t *testing.T) {
|
||||
// Note these errors should be independent of the architecture.
|
||||
// Just run the test with amd64.
|
||||
parser := newParser("amd64")
|
||||
var buf bytes.Buffer
|
||||
var buf strings.Builder
|
||||
parser.errorWriter = &buf
|
||||
|
||||
for _, cat := range testcats {
|
||||
|
@ -5,7 +5,6 @@
|
||||
package lex
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"strings"
|
||||
"testing"
|
||||
"text/scanner"
|
||||
@ -275,7 +274,7 @@ func lines(a ...string) string {
|
||||
|
||||
// drain returns a single string representing the processed input tokens.
|
||||
func drain(input *Input) string {
|
||||
var buf bytes.Buffer
|
||||
var buf strings.Builder
|
||||
for {
|
||||
tok := input.Next()
|
||||
if tok == scanner.EOF {
|
||||
|
Loading…
Reference in New Issue
Block a user