| 1 | // Copyright 2014 The Go Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style |
| 3 | // license that can be found in the LICENSE file. |
| 4 | |
| 5 | package seqscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/bind/seq`/ |
| 6 | |
| 7 | import ( |
| 8 | "testingscip-go gomod github.com/golang/go/src go1.24.0 testing/" |
| 9 | "unicode/utf16scip-go gomod github.com/golang/go/src go1.24.0 `unicode/utf16`/" |
| 10 | ) |
| 11 | |
| 12 | var strDatascip-go gomod golang.org/x/mobile . `golang.org/x/mobile/bind/seq`/strData. = []string{ |
| 13 | "abcxyz09{}", |
| 14 | "Hello, 世界", |
| 15 | string([]rune{0xffff, 0x10000, 0x10001, 0x12345, 0x10ffff}), |
| 16 | } |
| 17 | |
| 18 | func TestStringscip-go gomod golang.org/x/mobile . `golang.org/x/mobile/bind/seq`/TestString().(t *testingscip-go gomod github.com/golang/go/src go1.24.0 testing/.Tscip-go gomod github.com/golang/go/src go1.24.0 testing/T#) { |
| 19 | for _, test := range strDatascip-go gomod golang.org/x/mobile . `golang.org/x/mobile/bind/seq`/strData. { |
| 20 | chars := make([]uint16, 4*len(test)) |
| 21 | nchars := UTF16Encodescip-go gomod golang.org/x/mobile . `golang.org/x/mobile/bind/seq`/UTF16Encode().(test, chars) |
| 22 | chars = chars[:nchars] |
| 23 | got := string(utf16scip-go gomod github.com/golang/go/src go1.24.0 `unicode/utf16`/.Decodescip-go gomod github.com/golang/go/src go1.24.0 `unicode/utf16`/Decode().(chars)) |
| 24 | if got != test { |
| 25 | t.Errorfscip-go gomod github.com/golang/go/src go1.24.0 testing/common#Errorf().("UTF16: got %q, want %q", got, test) |
| 26 | } |
| 27 | } |
| 28 | } |