From 54d3d47daf9190275bbdaf8703b84969a4593451 Mon Sep 17 00:00:00 2001 From: Corey Hulen Date: Fri, 24 Mar 2017 23:31:34 -0700 Subject: PLT-6076 Adding viper libs for config file changes (#5871) * Adding viper libs for config file changes * Removing the old fsnotify lib * updating some missing libs --- vendor/golang.org/x/text/internal/match_test.go | 56 +++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 vendor/golang.org/x/text/internal/match_test.go (limited to 'vendor/golang.org/x/text/internal/match_test.go') diff --git a/vendor/golang.org/x/text/internal/match_test.go b/vendor/golang.org/x/text/internal/match_test.go new file mode 100644 index 000000000..8a3fe6572 --- /dev/null +++ b/vendor/golang.org/x/text/internal/match_test.go @@ -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 +} -- cgit v1.2.3-1-g7c22