1 // Copyright 2015 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.
12 "golang.org/x/text/language"
15 func TestUnique(t *testing.T) {
16 testCases := []struct {
23 {"en-u-cu-eur en", "[en en-u-cu-eur]"},
25 {"pt-Pt pt", "[pt pt-PT]"},
27 for _, tc := range testCases {
28 tags := []language.Tag{}
29 for _, s := range strings.Split(tc.in, " ") {
31 tags = append(tags, language.MustParse(s))
34 if got := fmt.Sprint(UniqueTags(tags)); got != tc.want {
35 t.Errorf("Unique(%s) = %s; want %s", tc.in, got, tc.want)