3 // Copyright 2012 The Go Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style
5 // license that can be found in the LICENSE file.
7 // Issue 5704: Conversions of empty strings to byte
8 // or rune slices return empty but non-nil slices.
18 func checkBytes(s
[]byte, arg
string) {
20 panic("len(" + arg
+ ") != 0")
23 panic(arg
+ " == nil")
27 func checkRunes(s
[]rune
, arg
string) {
29 panic("len(" + arg
+ ") != 0")
32 panic(arg
+ " == nil")
37 checkBytes([]byte(""), `[]byte("")`)
38 checkBytes([]byte(mystring("")), `[]byte(mystring(""))`)
39 checkBytes(mybytes(""), `mybytes("")`)
40 checkBytes(mybytes(mystring("")), `mybytes(mystring(""))`)
42 checkRunes([]rune(""), `[]rune("")`)
43 checkRunes([]rune(mystring("")), `[]rune(mystring(""))`)
44 checkRunes(myrunes(""), `myrunes("")`)
45 checkRunes(myrunes(mystring("")), `myrunes(mystring(""))`)