func TestReplace(t *testing.T) {
for _, tt := range ReplaceTests {
- in := append([]byte(tt.in), []byte("<spare>")...)
+ in := append([]byte(tt.in), "<spare>"...)
in = in[:len(tt.in)]
out := Replace(in, []byte(tt.old), []byte(tt.new), tt.n)
if s := string(out); s != tt.out {
success := make(chan bool, 1)
go func() {
buf := bytes.Repeat([]byte("\u035D"), 1024*1024)
- buf = append(buf, []byte("\u035B")...)
+ buf = append(buf, "\u035B"...)
norm.NFC.Append(nil, buf...)
success <- true
}()
func readFunc(size int) appendFunc {
return func(f Form, out []byte, s string) []byte {
- out = append(out, []byte(s)...)
+ out = append(out, s...)
r := f.Reader(bytes.NewBuffer(out))
buf := make([]byte, size)
result := []byte{}
func writeFunc(size int) appendFunc {
return func(f Form, out []byte, s string) []byte {
- in := append(out, []byte(s)...)
+ in := append(out, s...)
result := new(bytes.Buffer)
w := f.Writer(result)
buf := make([]byte, size)
out = append(out, byte(len(s)>>16))
out = append(out, byte(len(s)>>8))
out = append(out, byte(len(s)))
- out = append(out, []byte(s)...)
+ out = append(out, s...)
case reflect.Slice:
switch t.Elem().Kind() {
case reflect.Uint8:
if j != 0 {
out = append(out, ',')
}
- out = append(out, []byte(field.Index(j).String())...)
+ out = append(out, field.Index(j).String()...)
}
default:
panic("slice of unknown type")
t.Errorf("invalid rest: %d", len(rest))
}
- item, rest, err = nextValue(append(jsonBig, []byte("HELLO WORLD")...), &scan)
+ item, rest, err = nextValue(append(jsonBig, "HELLO WORLD"...), &scan)
if err != nil {
t.Fatalf("nextValue extra: %s", err)
}
panic(NewError("string too long"))
}
b = pbit16(b, uint16(len(s)))
- b = append(b, []byte(s)...)
+ b = append(b, s...)
return b
}
i := 0
for j := 0; j < len(s); j++ {
if s[j] == '$' && j+1 < len(s) {
- buf = append(buf, []byte(s[i:j])...)
+ buf = append(buf, s[i:j]...)
name, w := getShellName(s[j+1:])
- buf = append(buf, []byte(mapping(name))...)
+ buf = append(buf, mapping(name)...)
j += w
i = j + 1
}