aboutsummaryrefslogtreecommitdiff
path: root/test/stringrange.go
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2011-10-25 22:20:02 -0700
committerRuss Cox <rsc@golang.org>2011-10-25 22:20:02 -0700
commitdb33959797ad8ef1e86725db62aafb40297ea725 (patch)
tree83205f46a52d3ebc4a22cc151968d958b8524b28 /test/stringrange.go
parent6ed3fa6553d84391157eae963eeee5f20b6dca74 (diff)
downloadgo-db33959797ad8ef1e86725db62aafb40297ea725.tar.gz
go-db33959797ad8ef1e86725db62aafb40297ea725.zip
cgo, goyacc, go/build, html, http, path, path/filepath, testing/quick, test: use rune
Nothing terribly interesting here. R=golang-dev, bradfitz, gri, r CC=golang-dev https://golang.org/cl/5300043
Diffstat (limited to 'test/stringrange.go')
-rw-r--r--test/stringrange.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/test/stringrange.go b/test/stringrange.go
index d5ada2628d..924022b48e 100644
--- a/test/stringrange.go
+++ b/test/stringrange.go
@@ -14,23 +14,24 @@ import (
func main() {
s := "\000\123\x00\xca\xFE\u0123\ubabe\U0000babe\U0010FFFFx"
- expect := []int{ 0, 0123, 0, 0xFFFD, 0xFFFD, 0x123, 0xbabe, 0xbabe, 0x10FFFF, 'x' }
+ expect := []rune{0, 0123, 0, 0xFFFD, 0xFFFD, 0x123, 0xbabe, 0xbabe, 0x10FFFF, 'x'}
offset := 0
- var i, c int
+ var i int
+ var c rune
ok := true
cnum := 0
for i, c = range s {
- rune, size := utf8.DecodeRuneInString(s[i:len(s)]) // check it another way
+ r, size := utf8.DecodeRuneInString(s[i:len(s)]) // check it another way
if i != offset {
fmt.Printf("unexpected offset %d not %d\n", i, offset)
ok = false
}
- if rune != expect[cnum] {
- fmt.Printf("unexpected rune %d from DecodeRuneInString: %x not %x\n", i, rune, expect[cnum])
+ if r != expect[cnum] {
+ fmt.Printf("unexpected rune %d from DecodeRuneInString: %x not %x\n", i, r, expect[cnum])
ok = false
}
if c != expect[cnum] {
- fmt.Printf("unexpected rune %d from range: %x not %x\n", i, rune, expect[cnum])
+ fmt.Printf("unexpected rune %d from range: %x not %x\n", i, r, expect[cnum])
ok = false
}
offset += size