X-Git-Url: http://git.osdn.net/view?p=bytom%2Fvapor.git;a=blobdiff_plain;f=vendor%2Fgolang.org%2Fx%2Ftext%2Finternal%2Fexport%2Fidna%2Fexample_test.go;fp=vendor%2Fgolang.org%2Fx%2Ftext%2Finternal%2Fexport%2Fidna%2Fexample_test.go;h=0000000000000000000000000000000000000000;hp=6e6b8727cd4ef64cc6cefb36a2df4e06dc082c74;hb=d09b7a78d44dc259725902b8141cdba0d716b121;hpb=ee01d543fdfe1fd0a4d548965c66f7923ea7b062 diff --git a/vendor/golang.org/x/text/internal/export/idna/example_test.go b/vendor/golang.org/x/text/internal/export/idna/example_test.go deleted file mode 100644 index 6e6b8727..00000000 --- a/vendor/golang.org/x/text/internal/export/idna/example_test.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2017 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 idna_test - -import ( - "fmt" - - "golang.org/x/text/internal/export/idna" -) - -func ExampleProfile() { - // Raw Punycode has no restrictions and does no mappings. - fmt.Println(idna.ToASCII("")) - fmt.Println(idna.ToASCII("*.faß.com")) - fmt.Println(idna.Punycode.ToASCII("*.faß.com")) - - // Rewrite IDN for lookup. This (currently) uses transitional mappings to - // find a balance between IDNA2003 and IDNA2008 compatibility. - fmt.Println(idna.Lookup.ToASCII("")) - fmt.Println(idna.Lookup.ToASCII("www.faß.com")) - - // Convert an IDN to ASCII for registration purposes. This changes the - // encoding, but reports an error if the input was illformed. - fmt.Println(idna.Registration.ToASCII("")) - fmt.Println(idna.Registration.ToASCII("www.faß.com")) - - // Output: - // - // *.xn--fa-hia.com - // *.xn--fa-hia.com - // - // www.fass.com - // idna: invalid label "" - // www.xn--fa-hia.com -} - -func ExampleNew() { - var p *idna.Profile - - // Raw Punycode has no restrictions and does no mappings. - p = idna.New() - fmt.Println(p.ToASCII("*.faß.com")) - - // Do mappings. Note that star is not allowed in a DNS lookup. - p = idna.New( - idna.MapForLookup(), - idna.Transitional(true)) // Map ß -> ss - fmt.Println(p.ToASCII("*.faß.com")) - - // Lookup for registration. Also does not allow '*'. - p = idna.New(idna.ValidateForRegistration()) - fmt.Println(p.ToUnicode("*.faß.com")) - - // Set up a profile maps for lookup, but allows wild cards. - p = idna.New( - idna.MapForLookup(), - idna.Transitional(true), // Map ß -> ss - idna.StrictDomainName(false)) // Set more permissive ASCII rules. - fmt.Println(p.ToASCII("*.faß.com")) - - // Output: - // *.xn--fa-hia.com - // *.fass.com idna: disallowed rune U+002A - // *.faß.com idna: disallowed rune U+002A - // *.fass.com -}