summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/miekg/dns/idn/example_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/miekg/dns/idn/example_test.go')
-rw-r--r--vendor/github.com/miekg/dns/idn/example_test.go18
1 files changed, 18 insertions, 0 deletions
diff --git a/vendor/github.com/miekg/dns/idn/example_test.go b/vendor/github.com/miekg/dns/idn/example_test.go
new file mode 100644
index 000000000..8833cd91d
--- /dev/null
+++ b/vendor/github.com/miekg/dns/idn/example_test.go
@@ -0,0 +1,18 @@
+package idn_test
+
+import (
+ "fmt"
+ "github.com/miekg/dns/idn"
+)
+
+func ExampleToPunycode() {
+ name := "インターネット.テスト"
+ fmt.Printf("%s -> %s", name, idn.ToPunycode(name))
+ // Output: インターネット.テスト -> xn--eckucmux0ukc.xn--zckzah
+}
+
+func ExampleFromPunycode() {
+ name := "xn--mgbaja8a1hpac.xn--mgbachtv"
+ fmt.Printf("%s -> %s", name, idn.FromPunycode(name))
+ // Output: xn--mgbaja8a1hpac.xn--mgbachtv -> الانترنت.اختبار
+}