summaryrefslogtreecommitdiff
path: root/src/lib/utf8_test.go
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2009-02-06 17:54:26 -0800
committerRob Pike <r@golang.org>2009-02-06 17:54:26 -0800
commitaf453527aec6688b75e3ae72de78c76920de8569 (patch)
tree2c4197b8de65fcc683cb84de39fb2de011f08a9f /src/lib/utf8_test.go
parent3669adf2ff20dc664fd2f4d8cf77063d92dbc09a (diff)
downloadgolang-af453527aec6688b75e3ae72de78c76920de8569.tar.gz
portable stat for os
add name to os.FD clean up some interfaces R=rsc DELTA=318 (231 added, 44 deleted, 43 changed) OCL=24624 CL=24627
Diffstat (limited to 'src/lib/utf8_test.go')
-rw-r--r--src/lib/utf8_test.go11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/lib/utf8_test.go b/src/lib/utf8_test.go
index 2cb15889e..7999afd2e 100644
--- a/src/lib/utf8_test.go
+++ b/src/lib/utf8_test.go
@@ -6,6 +6,7 @@ package utf8
import (
"fmt";
+ "io";
"syscall";
"testing";
"utf8";
@@ -44,13 +45,11 @@ var utf8map = []Utf8Map {
Utf8Map{ 0x10ffff, "\xf4\x8f\xbf\xbf" },
}
-// like io.StringBytes but leaves one extra byte at end
+// io.StringBytes with one extra byte at end
func bytes(s string) []byte {
- b := make([]byte, len(s)+1);
- if !syscall.StringToBytes(b, s) {
- panic("StringTobytes failed");
- }
- return b[0:len(s)];
+ s += "\x00";
+ b := io.StringBytes(s);
+ return b[0:len(s)-1];
}
func TestFullRune(t *testing.T) {