1 // $G $F.go && $L $F.$A && ./$A.out
3 // Copyright 2009 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.
20 for i
:= 0; i
< 6; i
++ {
24 for w
, i
, j
:= 0,0,0; i
< l
; i
+= w
{
26 r
, w
= utf8
.DecodeRuneInString(s
[i
:len(s
)])
27 if w
== 0 { panic("zero width in string") }
28 if r
!= chars
[j
] { panic("wrong value from string") }
31 // encoded as bytes: 'a' 'b' 'c' e6 97 a5 e6 9c ac e8 aa 9e
33 if L
!= l
{ panic("wrong length constructing array") }
47 for w
, i
, j
:= 0,0,0; i
< L
; i
+= w
{
49 r
, w
= utf8
.DecodeRune(a
[i
:L
])
50 if w
== 0 { panic("zero width in bytes") }
51 if r
!= chars
[j
] { panic("wrong value from bytes") }