Debian Codegraph @

bind/seq/string_test.go

raw symbols SCIP
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 seq
6
7 import (
8 "testing"
9 "unicode/utf16"
10 )
11
12 var strData = []string{
13 "abcxyz09{}",
14 "Hello, 世界",
15 string([]rune{0xffff, 0x10000, 0x10001, 0x12345, 0x10ffff}),
16 }
17
18 func TestString(t *testing.T) {
19 for _, test := range strData {
20 chars := make([]uint16, 4*len(test))
21 nchars := UTF16Encode(test, chars)
22 chars = chars[:nchars]
23 got := string(utf16.Decode(chars))
24 if got != test {
25 t.Errorf("UTF16: got %q, want %q", got, test)
26 }
27 }
28 }