Checking in vendor folder for ease of using go get.

This commit is contained in:
Renan DelValle 2018-10-23 23:32:59 -07:00
commit cdb4b5a1d0
No known key found for this signature in database
GPG key ID: C240AD6D6F443EC9
3554 changed files with 1270116 additions and 0 deletions
vendor/golang.org/x/text/internal

56
vendor/golang.org/x/text/internal/match_test.go generated vendored Normal file
View file

@ -0,0 +1,56 @@
// Copyright 2015 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.
package internal
import (
"strings"
"testing"
"golang.org/x/text/language"
)
func TestInheritanceMatcher(t *testing.T) {
for i, tt := range []struct {
haveTags string
wantTags string
match string
conf language.Confidence
}{
{"und,en,en-US", "en-US", "en-US", language.Exact}, // most specific match
{"zh-Hant,zh", "zh-TW", "zh-Hant", language.High}, // zh-TW implies Hant.
{"und,zh", "zh-TW", "und", language.High}, // zh-TW does not match zh.
{"zh", "zh-TW", "und", language.No}, // zh-TW does not match zh.
{"iw,en,nl", "he", "he", language.Exact}, // matches after canonicalization
{"he,en,nl", "iw", "he", language.Exact}, // matches after canonicalization
// Prefer first match over more specific match for various reasons:
// a) consistency of user interface is more important than an exact match,
// b) _if_ und is specified, it should be considered a correct and useful match,
// Note that a call to this Match will almost always be with a single tag.
{"und,en,en-US", "he,en-US", "und", language.High},
} {
have := parseTags(tt.haveTags)
m := NewInheritanceMatcher(have)
tag, index, conf := m.Match(parseTags(tt.wantTags)...)
want := language.Raw.Make(tt.match)
if tag != want {
t.Errorf("%d:tag: got %q; want %q", i, tag, want)
}
if conf != language.No {
if got, _ := language.All.Canonicalize(have[index]); got != want {
t.Errorf("%d:index: got %q; want %q ", i, got, want)
}
}
if conf != tt.conf {
t.Errorf("%d:conf: got %v; want %v", i, conf, tt.conf)
}
}
}
func parseTags(list string) (out []language.Tag) {
for _, s := range strings.Split(list, ",") {
out = append(out, language.Raw.Make(strings.TrimSpace(s)))
}
return out
}