]> Cypherpunks.ru repositories - gostls13.git/blobdiff - test/stringrange.go
cmd/compile/internal/inline: score call sites exposed by inlines
[gostls13.git] / test / stringrange.go
index 6a7063e239d3dc70d03a2553eaa28b8383c5289d..99e5edb5a429d1ce4dc0ca30e4bc77385018c8ef 100644 (file)
@@ -1,9 +1,11 @@
-// $G $F.go && $L $F.$A && ./$A.out
+// run
 
 // Copyright 2009 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
+// Test range over strings.
+
 package main
 
 import (
@@ -55,6 +57,13 @@ func main() {
                ok = false
        }
 
+       for _, c := range "a\xed\xa0\x80a" {
+               if c != 'a' && c != utf8.RuneError {
+                       fmt.Printf("surrogate UTF-8 does not error: %U\n", c)
+                       ok = false
+               }
+       }
+
        if !ok {
                fmt.Println("BUG: stringrange")
                os.Exit(1)