ires 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +32 -45
- data/ext/Gopkg.lock +31 -1
- data/ext/ires/image.go +227 -0
- data/ext/ires/ires.go +47 -59
- data/ext/ires/uri.go +143 -0
- data/ext/main.go +18 -9
- data/ext/vendor/github.com/PuerkitoBio/purell/LICENSE +12 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/README.md +187 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/bench_test.go +57 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/benchmarks/v0.1.0 +9 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/example_test.go +35 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/purell.go +379 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/purell_test.go +768 -0
- data/ext/vendor/github.com/PuerkitoBio/purell/urlnorm_test.go +53 -0
- data/ext/vendor/github.com/PuerkitoBio/urlesc/LICENSE +27 -0
- data/ext/vendor/github.com/PuerkitoBio/urlesc/README.md +16 -0
- data/ext/vendor/github.com/PuerkitoBio/urlesc/urlesc.go +180 -0
- data/ext/vendor/github.com/PuerkitoBio/urlesc/urlesc_test.go +641 -0
- data/ext/vendor/github.com/{satori/go.uuid → goware/urlx}/LICENSE +3 -1
- data/ext/vendor/github.com/goware/urlx/README.md +172 -0
- data/ext/vendor/github.com/goware/urlx/urlx.go +196 -0
- data/ext/vendor/github.com/goware/urlx/urlx_test.go +232 -0
- data/ext/vendor/golang.org/x/net/AUTHORS +3 -0
- data/ext/vendor/golang.org/x/net/CONTRIBUTING.md +31 -0
- data/ext/vendor/golang.org/x/net/CONTRIBUTORS +3 -0
- data/ext/vendor/golang.org/x/net/LICENSE +27 -0
- data/ext/vendor/golang.org/x/net/PATENTS +22 -0
- data/ext/vendor/golang.org/x/net/README.md +16 -0
- data/ext/vendor/golang.org/x/net/bpf/asm.go +41 -0
- data/ext/vendor/golang.org/x/net/bpf/constants.go +218 -0
- data/ext/vendor/golang.org/x/net/bpf/doc.go +82 -0
- data/ext/vendor/golang.org/x/net/bpf/instructions.go +704 -0
- data/ext/vendor/golang.org/x/net/bpf/instructions_test.go +525 -0
- data/ext/vendor/golang.org/x/net/bpf/setter.go +10 -0
- data/ext/vendor/golang.org/x/net/bpf/testdata/all_instructions.bpf +1 -0
- data/ext/vendor/golang.org/x/net/bpf/testdata/all_instructions.txt +79 -0
- data/ext/vendor/golang.org/x/net/bpf/vm.go +140 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_aluop_test.go +512 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_bpf_test.go +192 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_extension_test.go +49 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_instructions.go +174 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_jump_test.go +380 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_load_test.go +246 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_ret_test.go +115 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_scratch_test.go +247 -0
- data/ext/vendor/golang.org/x/net/bpf/vm_test.go +144 -0
- data/ext/vendor/golang.org/x/net/codereview.cfg +1 -0
- data/ext/vendor/golang.org/x/net/context/context.go +54 -0
- data/ext/vendor/golang.org/x/net/context/context_test.go +583 -0
- data/ext/vendor/golang.org/x/net/context/ctxhttp/ctxhttp.go +74 -0
- data/ext/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_17_test.go +29 -0
- data/ext/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_pre17.go +147 -0
- data/ext/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_pre17_test.go +79 -0
- data/ext/vendor/golang.org/x/net/context/ctxhttp/ctxhttp_test.go +105 -0
- data/ext/vendor/golang.org/x/net/context/go17.go +72 -0
- data/ext/vendor/golang.org/x/net/context/go19.go +20 -0
- data/ext/vendor/golang.org/x/net/context/pre_go17.go +300 -0
- data/ext/vendor/golang.org/x/net/context/pre_go19.go +109 -0
- data/ext/vendor/golang.org/x/net/context/withtimeout_test.go +31 -0
- data/ext/vendor/golang.org/x/net/dict/dict.go +210 -0
- data/ext/vendor/golang.org/x/net/dns/dnsmessage/example_test.go +132 -0
- data/ext/vendor/golang.org/x/net/dns/dnsmessage/message.go +1997 -0
- data/ext/vendor/golang.org/x/net/dns/dnsmessage/message_test.go +1116 -0
- data/ext/vendor/golang.org/x/net/html/atom/atom.go +78 -0
- data/ext/vendor/golang.org/x/net/html/atom/atom_test.go +109 -0
- data/ext/vendor/golang.org/x/net/html/atom/gen.go +709 -0
- data/ext/vendor/golang.org/x/net/html/atom/table.go +777 -0
- data/ext/vendor/golang.org/x/net/html/atom/table_test.go +373 -0
- data/ext/vendor/golang.org/x/net/html/charset/charset.go +257 -0
- data/ext/vendor/golang.org/x/net/html/charset/charset_test.go +237 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/HTTP-charset.html +48 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/HTTP-vs-UTF-8-BOM.html +48 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/HTTP-vs-meta-charset.html +49 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/HTTP-vs-meta-content.html +49 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/No-encoding-declaration.html +47 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/README +9 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/UTF-16BE-BOM.html +0 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/UTF-16LE-BOM.html +0 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/UTF-8-BOM-vs-meta-charset.html +49 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/UTF-8-BOM-vs-meta-content.html +48 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/meta-charset-attribute.html +48 -0
- data/ext/vendor/golang.org/x/net/html/charset/testdata/meta-content-attribute.html +48 -0
- data/ext/vendor/golang.org/x/net/html/const.go +104 -0
- data/ext/vendor/golang.org/x/net/html/doc.go +106 -0
- data/ext/vendor/golang.org/x/net/html/doctype.go +156 -0
- data/ext/vendor/golang.org/x/net/html/entity.go +2253 -0
- data/ext/vendor/golang.org/x/net/html/entity_test.go +29 -0
- data/ext/vendor/golang.org/x/net/html/escape.go +258 -0
- data/ext/vendor/golang.org/x/net/html/escape_test.go +97 -0
- data/ext/vendor/golang.org/x/net/html/example_test.go +40 -0
- data/ext/vendor/golang.org/x/net/html/foreign.go +226 -0
- data/ext/vendor/golang.org/x/net/html/node.go +193 -0
- data/ext/vendor/golang.org/x/net/html/node_test.go +146 -0
- data/ext/vendor/golang.org/x/net/html/parse.go +2094 -0
- data/ext/vendor/golang.org/x/net/html/parse_test.go +388 -0
- data/ext/vendor/golang.org/x/net/html/render.go +271 -0
- data/ext/vendor/golang.org/x/net/html/render_test.go +156 -0
- data/ext/vendor/golang.org/x/net/html/testdata/go1.html +2237 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/README +28 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/adoption01.dat +194 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/adoption02.dat +31 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/comments01.dat +135 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/doctype01.dat +370 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/entities01.dat +603 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/entities02.dat +249 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/html5test-com.dat +246 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/inbody01.dat +43 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/isindex.dat +40 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/pending-spec-changes-plain-text-unsafe.dat +0 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/pending-spec-changes.dat +52 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/plain-text-unsafe.dat +0 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/scriptdata01.dat +308 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/scripted/adoption01.dat +15 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/scripted/webkit01.dat +28 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tables01.dat +212 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests1.dat +1952 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests10.dat +799 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests11.dat +482 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests12.dat +62 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests14.dat +74 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests15.dat +208 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests16.dat +2299 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests17.dat +153 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests18.dat +269 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests19.dat +1237 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests2.dat +763 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests20.dat +455 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests21.dat +221 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests22.dat +157 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests23.dat +155 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests24.dat +79 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests25.dat +219 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests26.dat +313 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests3.dat +305 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests4.dat +59 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests5.dat +191 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests6.dat +663 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests7.dat +390 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests8.dat +148 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests9.dat +457 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tests_innerHTML_1.dat +741 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/tricky01.dat +261 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/webkit01.dat +610 -0
- data/ext/vendor/golang.org/x/net/html/testdata/webkit/webkit02.dat +159 -0
- data/ext/vendor/golang.org/x/net/html/token.go +1219 -0
- data/ext/vendor/golang.org/x/net/html/token_test.go +748 -0
- data/ext/vendor/golang.org/x/net/http2/Dockerfile +51 -0
- data/ext/vendor/golang.org/x/net/http2/Makefile +3 -0
- data/ext/vendor/golang.org/x/net/http2/README +20 -0
- data/ext/vendor/golang.org/x/net/http2/ciphers.go +641 -0
- data/ext/vendor/golang.org/x/net/http2/ciphers_test.go +309 -0
- data/ext/vendor/golang.org/x/net/http2/client_conn_pool.go +256 -0
- data/ext/vendor/golang.org/x/net/http2/configure_transport.go +80 -0
- data/ext/vendor/golang.org/x/net/http2/databuffer.go +146 -0
- data/ext/vendor/golang.org/x/net/http2/databuffer_test.go +157 -0
- data/ext/vendor/golang.org/x/net/http2/errors.go +133 -0
- data/ext/vendor/golang.org/x/net/http2/errors_test.go +24 -0
- data/ext/vendor/golang.org/x/net/http2/flow.go +50 -0
- data/ext/vendor/golang.org/x/net/http2/flow_test.go +53 -0
- data/ext/vendor/golang.org/x/net/http2/frame.go +1579 -0
- data/ext/vendor/golang.org/x/net/http2/frame_test.go +1191 -0
- data/ext/vendor/golang.org/x/net/http2/go16.go +16 -0
- data/ext/vendor/golang.org/x/net/http2/go17.go +106 -0
- data/ext/vendor/golang.org/x/net/http2/go17_not18.go +36 -0
- data/ext/vendor/golang.org/x/net/http2/go18.go +56 -0
- data/ext/vendor/golang.org/x/net/http2/go18_test.go +79 -0
- data/ext/vendor/golang.org/x/net/http2/go19.go +16 -0
- data/ext/vendor/golang.org/x/net/http2/go19_test.go +60 -0
- data/ext/vendor/golang.org/x/net/http2/gotrack.go +170 -0
- data/ext/vendor/golang.org/x/net/http2/gotrack_test.go +33 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/Makefile +8 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/README +16 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/h2demo.go +538 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/launch.go +302 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/rootCA.key +27 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/rootCA.pem +26 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/rootCA.srl +1 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/server.crt +20 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/server.key +27 -0
- data/ext/vendor/golang.org/x/net/http2/h2demo/tmpl.go +1991 -0
- data/ext/vendor/golang.org/x/net/http2/h2i/README.md +97 -0
- data/ext/vendor/golang.org/x/net/http2/h2i/h2i.go +522 -0
- data/ext/vendor/golang.org/x/net/http2/headermap.go +78 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/encode.go +240 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/encode_test.go +386 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/hpack.go +490 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/hpack_test.go +722 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/huffman.go +212 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/tables.go +479 -0
- data/ext/vendor/golang.org/x/net/http2/hpack/tables_test.go +214 -0
- data/ext/vendor/golang.org/x/net/http2/http2.go +391 -0
- data/ext/vendor/golang.org/x/net/http2/http2_test.go +199 -0
- data/ext/vendor/golang.org/x/net/http2/not_go16.go +21 -0
- data/ext/vendor/golang.org/x/net/http2/not_go17.go +87 -0
- data/ext/vendor/golang.org/x/net/http2/not_go18.go +29 -0
- data/ext/vendor/golang.org/x/net/http2/not_go19.go +16 -0
- data/ext/vendor/golang.org/x/net/http2/pipe.go +163 -0
- data/ext/vendor/golang.org/x/net/http2/pipe_test.go +130 -0
- data/ext/vendor/golang.org/x/net/http2/server.go +2857 -0
- data/ext/vendor/golang.org/x/net/http2/server_push_test.go +521 -0
- data/ext/vendor/golang.org/x/net/http2/server_test.go +3721 -0
- data/ext/vendor/golang.org/x/net/http2/testdata/draft-ietf-httpbis-http2.xml +5021 -0
- data/ext/vendor/golang.org/x/net/http2/transport.go +2285 -0
- data/ext/vendor/golang.org/x/net/http2/transport_test.go +3714 -0
- data/ext/vendor/golang.org/x/net/http2/write.go +370 -0
- data/ext/vendor/golang.org/x/net/http2/writesched.go +242 -0
- data/ext/vendor/golang.org/x/net/http2/writesched_priority.go +452 -0
- data/ext/vendor/golang.org/x/net/http2/writesched_priority_test.go +541 -0
- data/ext/vendor/golang.org/x/net/http2/writesched_random.go +72 -0
- data/ext/vendor/golang.org/x/net/http2/writesched_random_test.go +44 -0
- data/ext/vendor/golang.org/x/net/http2/writesched_test.go +125 -0
- data/ext/vendor/golang.org/x/net/http2/z_spec_test.go +356 -0
- data/ext/vendor/golang.org/x/net/icmp/dstunreach.go +41 -0
- data/ext/vendor/golang.org/x/net/icmp/echo.go +45 -0
- data/ext/vendor/golang.org/x/net/icmp/endpoint.go +113 -0
- data/ext/vendor/golang.org/x/net/icmp/example_test.go +63 -0
- data/ext/vendor/golang.org/x/net/icmp/extension.go +89 -0
- data/ext/vendor/golang.org/x/net/icmp/extension_test.go +259 -0
- data/ext/vendor/golang.org/x/net/icmp/helper_posix.go +75 -0
- data/ext/vendor/golang.org/x/net/icmp/interface.go +236 -0
- data/ext/vendor/golang.org/x/net/icmp/ipv4.go +61 -0
- data/ext/vendor/golang.org/x/net/icmp/ipv4_test.go +83 -0
- data/ext/vendor/golang.org/x/net/icmp/ipv6.go +23 -0
- data/ext/vendor/golang.org/x/net/icmp/listen_posix.go +100 -0
- data/ext/vendor/golang.org/x/net/icmp/listen_stub.go +33 -0
- data/ext/vendor/golang.org/x/net/icmp/message.go +152 -0
- data/ext/vendor/golang.org/x/net/icmp/message_test.go +134 -0
- data/ext/vendor/golang.org/x/net/icmp/messagebody.go +41 -0
- data/ext/vendor/golang.org/x/net/icmp/mpls.go +77 -0
- data/ext/vendor/golang.org/x/net/icmp/multipart.go +109 -0
- data/ext/vendor/golang.org/x/net/icmp/multipart_test.go +442 -0
- data/ext/vendor/golang.org/x/net/icmp/packettoobig.go +43 -0
- data/ext/vendor/golang.org/x/net/icmp/paramprob.go +63 -0
- data/ext/vendor/golang.org/x/net/icmp/ping_test.go +200 -0
- data/ext/vendor/golang.org/x/net/icmp/sys_freebsd.go +11 -0
- data/ext/vendor/golang.org/x/net/icmp/timeexceeded.go +39 -0
- data/ext/vendor/golang.org/x/net/idna/example_test.go +70 -0
- data/ext/vendor/golang.org/x/net/idna/idna.go +680 -0
- data/ext/vendor/golang.org/x/net/idna/idna_test.go +108 -0
- data/ext/vendor/golang.org/x/net/idna/punycode.go +203 -0
- data/ext/vendor/golang.org/x/net/idna/punycode_test.go +198 -0
- data/ext/vendor/golang.org/x/net/idna/tables.go +4477 -0
- data/ext/vendor/golang.org/x/net/idna/trie.go +72 -0
- data/ext/vendor/golang.org/x/net/idna/trieval.go +114 -0
- data/ext/vendor/golang.org/x/net/internal/iana/const.go +180 -0
- data/ext/vendor/golang.org/x/net/internal/iana/gen.go +293 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/helper_bsd.go +53 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/helper_nobsd.go +15 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/helper_posix.go +31 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/helper_stub.go +32 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/helper_unix.go +29 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/helper_windows.go +42 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/interface.go +94 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/rlimit.go +11 -0
- data/ext/vendor/golang.org/x/net/internal/nettest/stack.go +147 -0
- data/ext/vendor/golang.org/x/net/internal/socket/cmsghdr.go +11 -0
- data/ext/vendor/golang.org/x/net/internal/socket/cmsghdr_bsd.go +13 -0
- data/ext/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_32bit.go +14 -0
- data/ext/vendor/golang.org/x/net/internal/socket/cmsghdr_linux_64bit.go +14 -0
- data/ext/vendor/golang.org/x/net/internal/socket/cmsghdr_solaris_64bit.go +14 -0
- data/ext/vendor/golang.org/x/net/internal/socket/cmsghdr_stub.go +17 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_darwin.go +44 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_dragonfly.go +44 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_freebsd.go +44 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_linux.go +49 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_netbsd.go +47 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_openbsd.go +44 -0
- data/ext/vendor/golang.org/x/net/internal/socket/defs_solaris.go +44 -0
- data/ext/vendor/golang.org/x/net/internal/socket/error_unix.go +31 -0
- data/ext/vendor/golang.org/x/net/internal/socket/error_windows.go +26 -0
- data/ext/vendor/golang.org/x/net/internal/socket/iovec_32bit.go +19 -0
- data/ext/vendor/golang.org/x/net/internal/socket/iovec_64bit.go +19 -0
- data/ext/vendor/golang.org/x/net/internal/socket/iovec_solaris_64bit.go +19 -0
- data/ext/vendor/golang.org/x/net/internal/socket/iovec_stub.go +11 -0
- data/ext/vendor/golang.org/x/net/internal/socket/mmsghdr_stub.go +21 -0
- data/ext/vendor/golang.org/x/net/internal/socket/mmsghdr_unix.go +42 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_bsd.go +39 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_bsdvar.go +16 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_linux.go +36 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_linux_32bit.go +24 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_linux_64bit.go +24 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_openbsd.go +14 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_solaris_64bit.go +36 -0
- data/ext/vendor/golang.org/x/net/internal/socket/msghdr_stub.go +14 -0
- data/ext/vendor/golang.org/x/net/internal/socket/rawconn.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/rawconn_mmsg.go +74 -0
- data/ext/vendor/golang.org/x/net/internal/socket/rawconn_msg.go +77 -0
- data/ext/vendor/golang.org/x/net/internal/socket/rawconn_nommsg.go +18 -0
- data/ext/vendor/golang.org/x/net/internal/socket/rawconn_nomsg.go +18 -0
- data/ext/vendor/golang.org/x/net/internal/socket/rawconn_stub.go +25 -0
- data/ext/vendor/golang.org/x/net/internal/socket/reflect.go +62 -0
- data/ext/vendor/golang.org/x/net/internal/socket/socket.go +285 -0
- data/ext/vendor/golang.org/x/net/internal/socket/socket_go1_9_test.go +259 -0
- data/ext/vendor/golang.org/x/net/internal/socket/socket_test.go +46 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys.go +33 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_bsd.go +17 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_bsdvar.go +14 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_darwin.go +7 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_dragonfly.go +7 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux.go +27 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_386.go +55 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_386.s +11 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_amd64.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_arm.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_arm64.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_mips.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_mips64.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_mips64le.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_mipsle.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_ppc64.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_ppc64le.go +10 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_s390x.go +55 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_linux_s390x.s +11 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_netbsd.go +25 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_posix.go +168 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_solaris.go +71 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_solaris_amd64.s +11 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_stub.go +64 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_unix.go +33 -0
- data/ext/vendor/golang.org/x/net/internal/socket/sys_windows.go +70 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_darwin_386.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_darwin_amd64.go +61 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_darwin_arm.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_dragonfly_amd64.go +61 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_freebsd_386.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_freebsd_amd64.go +61 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_freebsd_arm.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_386.go +63 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_amd64.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_arm.go +63 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_arm64.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_mips.go +63 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_mips64.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_mips64le.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_mipsle.go +63 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_ppc64le.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_linux_s390x.go +66 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_netbsd_386.go +65 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_netbsd_amd64.go +68 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_netbsd_arm.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_openbsd_386.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_openbsd_amd64.go +61 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_openbsd_arm.go +59 -0
- data/ext/vendor/golang.org/x/net/internal/socket/zsys_solaris_amd64.go +60 -0
- data/ext/vendor/golang.org/x/net/internal/timeseries/timeseries.go +525 -0
- data/ext/vendor/golang.org/x/net/internal/timeseries/timeseries_test.go +170 -0
- data/ext/vendor/golang.org/x/net/ipv4/batch.go +191 -0
- data/ext/vendor/golang.org/x/net/ipv4/bpf_test.go +93 -0
- data/ext/vendor/golang.org/x/net/ipv4/control.go +144 -0
- data/ext/vendor/golang.org/x/net/ipv4/control_bsd.go +40 -0
- data/ext/vendor/golang.org/x/net/ipv4/control_pktinfo.go +39 -0
- data/ext/vendor/golang.org/x/net/ipv4/control_stub.go +13 -0
- data/ext/vendor/golang.org/x/net/ipv4/control_test.go +21 -0
- data/ext/vendor/golang.org/x/net/ipv4/control_unix.go +73 -0
- data/ext/vendor/golang.org/x/net/ipv4/control_windows.go +16 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_darwin.go +77 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_dragonfly.go +38 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_freebsd.go +75 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_linux.go +122 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_netbsd.go +37 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_openbsd.go +37 -0
- data/ext/vendor/golang.org/x/net/ipv4/defs_solaris.go +84 -0
- data/ext/vendor/golang.org/x/net/ipv4/dgramopt.go +265 -0
- data/ext/vendor/golang.org/x/net/ipv4/doc.go +244 -0
- data/ext/vendor/golang.org/x/net/ipv4/endpoint.go +187 -0
- data/ext/vendor/golang.org/x/net/ipv4/example_test.go +224 -0
- data/ext/vendor/golang.org/x/net/ipv4/gen.go +199 -0
- data/ext/vendor/golang.org/x/net/ipv4/genericopt.go +57 -0
- data/ext/vendor/golang.org/x/net/ipv4/header.go +159 -0
- data/ext/vendor/golang.org/x/net/ipv4/header_test.go +228 -0
- data/ext/vendor/golang.org/x/net/ipv4/helper.go +63 -0
- data/ext/vendor/golang.org/x/net/ipv4/iana.go +34 -0
- data/ext/vendor/golang.org/x/net/ipv4/icmp.go +57 -0
- data/ext/vendor/golang.org/x/net/ipv4/icmp_linux.go +25 -0
- data/ext/vendor/golang.org/x/net/ipv4/icmp_stub.go +25 -0
- data/ext/vendor/golang.org/x/net/ipv4/icmp_test.go +95 -0
- data/ext/vendor/golang.org/x/net/ipv4/multicast_test.go +334 -0
- data/ext/vendor/golang.org/x/net/ipv4/multicastlistener_test.go +265 -0
- data/ext/vendor/golang.org/x/net/ipv4/multicastsockopt_test.go +195 -0
- data/ext/vendor/golang.org/x/net/ipv4/packet.go +69 -0
- data/ext/vendor/golang.org/x/net/ipv4/packet_go1_8.go +56 -0
- data/ext/vendor/golang.org/x/net/ipv4/packet_go1_9.go +67 -0
- data/ext/vendor/golang.org/x/net/ipv4/payload.go +23 -0
- data/ext/vendor/golang.org/x/net/ipv4/payload_cmsg.go +36 -0
- data/ext/vendor/golang.org/x/net/ipv4/payload_cmsg_go1_8.go +59 -0
- data/ext/vendor/golang.org/x/net/ipv4/payload_cmsg_go1_9.go +67 -0
- data/ext/vendor/golang.org/x/net/ipv4/payload_nocmsg.go +42 -0
- data/ext/vendor/golang.org/x/net/ipv4/readwrite_go1_8_test.go +248 -0
- data/ext/vendor/golang.org/x/net/ipv4/readwrite_go1_9_test.go +388 -0
- data/ext/vendor/golang.org/x/net/ipv4/readwrite_test.go +140 -0
- data/ext/vendor/golang.org/x/net/ipv4/sockopt.go +44 -0
- data/ext/vendor/golang.org/x/net/ipv4/sockopt_posix.go +71 -0
- data/ext/vendor/golang.org/x/net/ipv4/sockopt_stub.go +42 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_asmreq.go +119 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_asmreq_stub.go +25 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_asmreqn.go +42 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_asmreqn_stub.go +21 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_bpf.go +23 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_bpf_stub.go +16 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_bsd.go +37 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_darwin.go +93 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_dragonfly.go +35 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_freebsd.go +76 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_linux.go +59 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_solaris.go +57 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_ssmreq.go +54 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_ssmreq_stub.go +21 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_stub.go +13 -0
- data/ext/vendor/golang.org/x/net/ipv4/sys_windows.go +67 -0
- data/ext/vendor/golang.org/x/net/ipv4/unicast_test.go +247 -0
- data/ext/vendor/golang.org/x/net/ipv4/unicastsockopt_test.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_darwin.go +99 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_dragonfly.go +31 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_freebsd_386.go +93 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_freebsd_amd64.go +95 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_freebsd_arm.go +95 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_386.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_amd64.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_arm.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_arm64.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_mips.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_mips64.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_mips64le.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_mipsle.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_ppc.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_ppc64.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_ppc64le.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_linux_s390x.go +150 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_netbsd.go +30 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_openbsd.go +30 -0
- data/ext/vendor/golang.org/x/net/ipv4/zsys_solaris.go +100 -0
- data/ext/vendor/golang.org/x/net/ipv6/batch.go +119 -0
- data/ext/vendor/golang.org/x/net/ipv6/bpf_test.go +96 -0
- data/ext/vendor/golang.org/x/net/ipv6/control.go +187 -0
- data/ext/vendor/golang.org/x/net/ipv6/control_rfc2292_unix.go +48 -0
- data/ext/vendor/golang.org/x/net/ipv6/control_rfc3542_unix.go +94 -0
- data/ext/vendor/golang.org/x/net/ipv6/control_stub.go +13 -0
- data/ext/vendor/golang.org/x/net/ipv6/control_test.go +21 -0
- data/ext/vendor/golang.org/x/net/ipv6/control_unix.go +55 -0
- data/ext/vendor/golang.org/x/net/ipv6/control_windows.go +16 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_darwin.go +112 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_dragonfly.go +84 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_freebsd.go +105 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_linux.go +147 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_netbsd.go +80 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_openbsd.go +89 -0
- data/ext/vendor/golang.org/x/net/ipv6/defs_solaris.go +114 -0
- data/ext/vendor/golang.org/x/net/ipv6/dgramopt.go +302 -0
- data/ext/vendor/golang.org/x/net/ipv6/doc.go +243 -0
- data/ext/vendor/golang.org/x/net/ipv6/endpoint.go +128 -0
- data/ext/vendor/golang.org/x/net/ipv6/example_test.go +216 -0
- data/ext/vendor/golang.org/x/net/ipv6/gen.go +199 -0
- data/ext/vendor/golang.org/x/net/ipv6/genericopt.go +58 -0
- data/ext/vendor/golang.org/x/net/ipv6/header.go +55 -0
- data/ext/vendor/golang.org/x/net/ipv6/header_test.go +55 -0
- data/ext/vendor/golang.org/x/net/ipv6/helper.go +57 -0
- data/ext/vendor/golang.org/x/net/ipv6/iana.go +82 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp.go +60 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp_bsd.go +29 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp_linux.go +27 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp_solaris.go +27 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp_stub.go +23 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp_test.go +96 -0
- data/ext/vendor/golang.org/x/net/ipv6/icmp_windows.go +22 -0
- data/ext/vendor/golang.org/x/net/ipv6/mocktransponder_test.go +32 -0
- data/ext/vendor/golang.org/x/net/ipv6/multicast_test.go +264 -0
- data/ext/vendor/golang.org/x/net/ipv6/multicastlistener_test.go +261 -0
- data/ext/vendor/golang.org/x/net/ipv6/multicastsockopt_test.go +157 -0
- data/ext/vendor/golang.org/x/net/ipv6/payload.go +23 -0
- data/ext/vendor/golang.org/x/net/ipv6/payload_cmsg.go +35 -0
- data/ext/vendor/golang.org/x/net/ipv6/payload_cmsg_go1_8.go +55 -0
- data/ext/vendor/golang.org/x/net/ipv6/payload_cmsg_go1_9.go +57 -0
- data/ext/vendor/golang.org/x/net/ipv6/payload_nocmsg.go +41 -0
- data/ext/vendor/golang.org/x/net/ipv6/readwrite_go1_8_test.go +242 -0
- data/ext/vendor/golang.org/x/net/ipv6/readwrite_go1_9_test.go +373 -0
- data/ext/vendor/golang.org/x/net/ipv6/readwrite_test.go +148 -0
- data/ext/vendor/golang.org/x/net/ipv6/sockopt.go +43 -0
- data/ext/vendor/golang.org/x/net/ipv6/sockopt_posix.go +87 -0
- data/ext/vendor/golang.org/x/net/ipv6/sockopt_stub.go +46 -0
- data/ext/vendor/golang.org/x/net/ipv6/sockopt_test.go +133 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_asmreq.go +24 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_asmreq_stub.go +17 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_bpf.go +23 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_bpf_stub.go +16 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_bsd.go +57 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_darwin.go +106 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_freebsd.go +92 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_linux.go +74 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_solaris.go +74 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_ssmreq.go +54 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_ssmreq_stub.go +21 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_stub.go +13 -0
- data/ext/vendor/golang.org/x/net/ipv6/sys_windows.go +75 -0
- data/ext/vendor/golang.org/x/net/ipv6/unicast_test.go +184 -0
- data/ext/vendor/golang.org/x/net/ipv6/unicastsockopt_test.go +120 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_darwin.go +131 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_dragonfly.go +88 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_freebsd_386.go +122 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_freebsd_amd64.go +124 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_freebsd_arm.go +124 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_386.go +170 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_amd64.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_arm.go +170 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_arm64.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_mips.go +170 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_mips64.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_mips64le.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_mipsle.go +170 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_ppc.go +170 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_ppc64.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_ppc64le.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_linux_s390x.go +172 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_netbsd.go +84 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_openbsd.go +93 -0
- data/ext/vendor/golang.org/x/net/ipv6/zsys_solaris.go +131 -0
- data/ext/vendor/golang.org/x/net/lex/httplex/httplex.go +351 -0
- data/ext/vendor/golang.org/x/net/lex/httplex/httplex_test.go +119 -0
- data/ext/vendor/golang.org/x/net/lif/address.go +105 -0
- data/ext/vendor/golang.org/x/net/lif/address_test.go +123 -0
- data/ext/vendor/golang.org/x/net/lif/binary.go +115 -0
- data/ext/vendor/golang.org/x/net/lif/defs_solaris.go +90 -0
- data/ext/vendor/golang.org/x/net/lif/lif.go +43 -0
- data/ext/vendor/golang.org/x/net/lif/link.go +126 -0
- data/ext/vendor/golang.org/x/net/lif/link_test.go +63 -0
- data/ext/vendor/golang.org/x/net/lif/sys.go +21 -0
- data/ext/vendor/golang.org/x/net/lif/sys_solaris_amd64.s +8 -0
- data/ext/vendor/golang.org/x/net/lif/syscall.go +28 -0
- data/ext/vendor/golang.org/x/net/lif/zsys_solaris_amd64.go +103 -0
- data/ext/vendor/golang.org/x/net/nettest/conntest.go +456 -0
- data/ext/vendor/golang.org/x/net/nettest/conntest_go16.go +24 -0
- data/ext/vendor/golang.org/x/net/nettest/conntest_go17.go +24 -0
- data/ext/vendor/golang.org/x/net/nettest/conntest_test.go +76 -0
- data/ext/vendor/golang.org/x/net/netutil/listen.go +48 -0
- data/ext/vendor/golang.org/x/net/netutil/listen_test.go +101 -0
- data/ext/vendor/golang.org/x/net/proxy/direct.go +18 -0
- data/ext/vendor/golang.org/x/net/proxy/per_host.go +140 -0
- data/ext/vendor/golang.org/x/net/proxy/per_host_test.go +55 -0
- data/ext/vendor/golang.org/x/net/proxy/proxy.go +134 -0
- data/ext/vendor/golang.org/x/net/proxy/proxy_test.go +215 -0
- data/ext/vendor/golang.org/x/net/proxy/socks5.go +214 -0
- data/ext/vendor/golang.org/x/net/publicsuffix/gen.go +713 -0
- data/ext/vendor/golang.org/x/net/publicsuffix/list.go +135 -0
- data/ext/vendor/golang.org/x/net/publicsuffix/list_test.go +416 -0
- data/ext/vendor/golang.org/x/net/publicsuffix/table.go +9419 -0
- data/ext/vendor/golang.org/x/net/publicsuffix/table_test.go +16756 -0
- data/ext/vendor/golang.org/x/net/route/address.go +425 -0
- data/ext/vendor/golang.org/x/net/route/address_darwin_test.go +63 -0
- data/ext/vendor/golang.org/x/net/route/address_test.go +103 -0
- data/ext/vendor/golang.org/x/net/route/binary.go +90 -0
- data/ext/vendor/golang.org/x/net/route/defs_darwin.go +114 -0
- data/ext/vendor/golang.org/x/net/route/defs_dragonfly.go +113 -0
- data/ext/vendor/golang.org/x/net/route/defs_freebsd.go +337 -0
- data/ext/vendor/golang.org/x/net/route/defs_netbsd.go +112 -0
- data/ext/vendor/golang.org/x/net/route/defs_openbsd.go +116 -0
- data/ext/vendor/golang.org/x/net/route/interface.go +64 -0
- data/ext/vendor/golang.org/x/net/route/interface_announce.go +32 -0
- data/ext/vendor/golang.org/x/net/route/interface_classic.go +66 -0
- data/ext/vendor/golang.org/x/net/route/interface_freebsd.go +78 -0
- data/ext/vendor/golang.org/x/net/route/interface_multicast.go +30 -0
- data/ext/vendor/golang.org/x/net/route/interface_openbsd.go +90 -0
- data/ext/vendor/golang.org/x/net/route/message.go +72 -0
- data/ext/vendor/golang.org/x/net/route/message_darwin_test.go +34 -0
- data/ext/vendor/golang.org/x/net/route/message_freebsd_test.go +92 -0
- data/ext/vendor/golang.org/x/net/route/message_test.go +239 -0
- data/ext/vendor/golang.org/x/net/route/route.go +123 -0
- data/ext/vendor/golang.org/x/net/route/route_classic.go +67 -0
- data/ext/vendor/golang.org/x/net/route/route_openbsd.go +65 -0
- data/ext/vendor/golang.org/x/net/route/route_test.go +390 -0
- data/ext/vendor/golang.org/x/net/route/sys.go +39 -0
- data/ext/vendor/golang.org/x/net/route/sys_darwin.go +87 -0
- data/ext/vendor/golang.org/x/net/route/sys_dragonfly.go +76 -0
- data/ext/vendor/golang.org/x/net/route/sys_freebsd.go +155 -0
- data/ext/vendor/golang.org/x/net/route/sys_netbsd.go +71 -0
- data/ext/vendor/golang.org/x/net/route/sys_openbsd.go +80 -0
- data/ext/vendor/golang.org/x/net/route/syscall.go +28 -0
- data/ext/vendor/golang.org/x/net/route/zsys_darwin.go +99 -0
- data/ext/vendor/golang.org/x/net/route/zsys_dragonfly.go +98 -0
- data/ext/vendor/golang.org/x/net/route/zsys_freebsd_386.go +126 -0
- data/ext/vendor/golang.org/x/net/route/zsys_freebsd_amd64.go +123 -0
- data/ext/vendor/golang.org/x/net/route/zsys_freebsd_arm.go +123 -0
- data/ext/vendor/golang.org/x/net/route/zsys_netbsd.go +97 -0
- data/ext/vendor/golang.org/x/net/route/zsys_openbsd.go +101 -0
- data/ext/vendor/golang.org/x/net/trace/events.go +532 -0
- data/ext/vendor/golang.org/x/net/trace/histogram.go +365 -0
- data/ext/vendor/golang.org/x/net/trace/histogram_test.go +325 -0
- data/ext/vendor/golang.org/x/net/trace/trace.go +1082 -0
- data/ext/vendor/golang.org/x/net/trace/trace_go16.go +21 -0
- data/ext/vendor/golang.org/x/net/trace/trace_go17.go +21 -0
- data/ext/vendor/golang.org/x/net/trace/trace_test.go +178 -0
- data/ext/vendor/golang.org/x/net/webdav/file.go +796 -0
- data/ext/vendor/golang.org/x/net/webdav/file_go1.6.go +17 -0
- data/ext/vendor/golang.org/x/net/webdav/file_go1.7.go +16 -0
- data/ext/vendor/golang.org/x/net/webdav/file_test.go +1184 -0
- data/ext/vendor/golang.org/x/net/webdav/if.go +173 -0
- data/ext/vendor/golang.org/x/net/webdav/if_test.go +322 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/README +11 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/atom_test.go +56 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/example_test.go +151 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/marshal.go +1223 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/marshal_test.go +1939 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/read.go +692 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/read_test.go +744 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/typeinfo.go +371 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/xml.go +1998 -0
- data/ext/vendor/golang.org/x/net/webdav/internal/xml/xml_test.go +752 -0
- data/ext/vendor/golang.org/x/net/webdav/litmus_test_server.go +94 -0
- data/ext/vendor/golang.org/x/net/webdav/lock.go +445 -0
- data/ext/vendor/golang.org/x/net/webdav/lock_test.go +731 -0
- data/ext/vendor/golang.org/x/net/webdav/prop.go +418 -0
- data/ext/vendor/golang.org/x/net/webdav/prop_test.go +613 -0
- data/ext/vendor/golang.org/x/net/webdav/webdav.go +702 -0
- data/ext/vendor/golang.org/x/net/webdav/webdav_test.go +344 -0
- data/ext/vendor/golang.org/x/net/webdav/xml.go +519 -0
- data/ext/vendor/golang.org/x/net/webdav/xml_test.go +906 -0
- data/ext/vendor/golang.org/x/net/websocket/client.go +106 -0
- data/ext/vendor/golang.org/x/net/websocket/dial.go +24 -0
- data/ext/vendor/golang.org/x/net/websocket/dial_test.go +43 -0
- data/ext/vendor/golang.org/x/net/websocket/exampledial_test.go +31 -0
- data/ext/vendor/golang.org/x/net/websocket/examplehandler_test.go +26 -0
- data/ext/vendor/golang.org/x/net/websocket/hybi.go +583 -0
- data/ext/vendor/golang.org/x/net/websocket/hybi_test.go +608 -0
- data/ext/vendor/golang.org/x/net/websocket/server.go +113 -0
- data/ext/vendor/golang.org/x/net/websocket/websocket.go +448 -0
- data/ext/vendor/golang.org/x/net/websocket/websocket_test.go +665 -0
- data/ext/vendor/golang.org/x/net/xsrftoken/xsrf.go +94 -0
- data/ext/vendor/golang.org/x/net/xsrftoken/xsrf_test.go +83 -0
- data/ext/vendor/golang.org/x/text/AUTHORS +3 -0
- data/ext/vendor/golang.org/x/text/CONTRIBUTING.md +31 -0
- data/ext/vendor/golang.org/x/text/CONTRIBUTORS +3 -0
- data/ext/vendor/golang.org/x/text/LICENSE +27 -0
- data/ext/vendor/golang.org/x/text/PATENTS +22 -0
- data/ext/vendor/golang.org/x/text/README.md +91 -0
- data/ext/vendor/golang.org/x/text/cases/cases.go +162 -0
- data/ext/vendor/golang.org/x/text/cases/context.go +376 -0
- data/ext/vendor/golang.org/x/text/cases/context_test.go +438 -0
- data/ext/vendor/golang.org/x/text/cases/example_test.go +53 -0
- data/ext/vendor/golang.org/x/text/cases/fold.go +34 -0
- data/ext/vendor/golang.org/x/text/cases/fold_test.go +51 -0
- data/ext/vendor/golang.org/x/text/cases/gen.go +839 -0
- data/ext/vendor/golang.org/x/text/cases/gen_trieval.go +219 -0
- data/ext/vendor/golang.org/x/text/cases/icu.go +61 -0
- data/ext/vendor/golang.org/x/text/cases/icu_test.go +210 -0
- data/ext/vendor/golang.org/x/text/cases/info.go +82 -0
- data/ext/vendor/golang.org/x/text/cases/map.go +816 -0
- data/ext/vendor/golang.org/x/text/cases/map_test.go +950 -0
- data/ext/vendor/golang.org/x/text/cases/tables.go +2251 -0
- data/ext/vendor/golang.org/x/text/cases/tables_test.go +1158 -0
- data/ext/vendor/golang.org/x/text/cases/trieval.go +215 -0
- data/ext/vendor/golang.org/x/text/cmd/gotext/doc.go +35 -0
- data/ext/vendor/golang.org/x/text/cmd/gotext/extract.go +195 -0
- data/ext/vendor/golang.org/x/text/cmd/gotext/main.go +356 -0
- data/ext/vendor/golang.org/x/text/cmd/gotext/message.go +127 -0
- data/ext/vendor/golang.org/x/text/codereview.cfg +1 -0
- data/ext/vendor/golang.org/x/text/collate/build/builder.go +702 -0
- data/ext/vendor/golang.org/x/text/collate/build/builder_test.go +290 -0
- data/ext/vendor/golang.org/x/text/collate/build/colelem.go +294 -0
- data/ext/vendor/golang.org/x/text/collate/build/colelem_test.go +215 -0
- data/ext/vendor/golang.org/x/text/collate/build/contract.go +309 -0
- data/ext/vendor/golang.org/x/text/collate/build/contract_test.go +266 -0
- data/ext/vendor/golang.org/x/text/collate/build/order.go +393 -0
- data/ext/vendor/golang.org/x/text/collate/build/order_test.go +229 -0
- data/ext/vendor/golang.org/x/text/collate/build/table.go +81 -0
- data/ext/vendor/golang.org/x/text/collate/build/trie.go +290 -0
- data/ext/vendor/golang.org/x/text/collate/build/trie_test.go +107 -0
- data/ext/vendor/golang.org/x/text/collate/collate.go +403 -0
- data/ext/vendor/golang.org/x/text/collate/collate_test.go +482 -0
- data/ext/vendor/golang.org/x/text/collate/export_test.go +51 -0
- data/ext/vendor/golang.org/x/text/collate/index.go +32 -0
- data/ext/vendor/golang.org/x/text/collate/maketables.go +553 -0
- data/ext/vendor/golang.org/x/text/collate/option.go +239 -0
- data/ext/vendor/golang.org/x/text/collate/option_test.go +209 -0
- data/ext/vendor/golang.org/x/text/collate/reg_test.go +230 -0
- data/ext/vendor/golang.org/x/text/collate/sort.go +81 -0
- data/ext/vendor/golang.org/x/text/collate/sort_test.go +55 -0
- data/ext/vendor/golang.org/x/text/collate/table_test.go +291 -0
- data/ext/vendor/golang.org/x/text/collate/tables.go +73789 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/Makefile +7 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/chars.go +1156 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/col.go +97 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/colcmp.go +529 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/darwin.go +111 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/gen.go +183 -0
- data/ext/vendor/golang.org/x/text/collate/tools/colcmp/icu.go +209 -0
- data/ext/vendor/golang.org/x/text/currency/common.go +66 -0
- data/ext/vendor/golang.org/x/text/currency/currency.go +185 -0
- data/ext/vendor/golang.org/x/text/currency/currency_test.go +171 -0
- data/ext/vendor/golang.org/x/text/currency/example_test.go +27 -0
- data/ext/vendor/golang.org/x/text/currency/format.go +215 -0
- data/ext/vendor/golang.org/x/text/currency/format_test.go +70 -0
- data/ext/vendor/golang.org/x/text/currency/gen.go +400 -0
- data/ext/vendor/golang.org/x/text/currency/gen_common.go +70 -0
- data/ext/vendor/golang.org/x/text/currency/query.go +152 -0
- data/ext/vendor/golang.org/x/text/currency/query_test.go +107 -0
- data/ext/vendor/golang.org/x/text/currency/tables.go +2574 -0
- data/ext/vendor/golang.org/x/text/currency/tables_test.go +93 -0
- data/ext/vendor/golang.org/x/text/doc.go +13 -0
- data/ext/vendor/golang.org/x/text/encoding/charmap/charmap.go +249 -0
- data/ext/vendor/golang.org/x/text/encoding/charmap/charmap_test.go +258 -0
- data/ext/vendor/golang.org/x/text/encoding/charmap/maketables.go +556 -0
- data/ext/vendor/golang.org/x/text/encoding/charmap/tables.go +7410 -0
- data/ext/vendor/golang.org/x/text/encoding/encoding.go +335 -0
- data/ext/vendor/golang.org/x/text/encoding/encoding_test.go +290 -0
- data/ext/vendor/golang.org/x/text/encoding/example_test.go +42 -0
- data/ext/vendor/golang.org/x/text/encoding/htmlindex/gen.go +173 -0
- data/ext/vendor/golang.org/x/text/encoding/htmlindex/htmlindex.go +86 -0
- data/ext/vendor/golang.org/x/text/encoding/htmlindex/htmlindex_test.go +144 -0
- data/ext/vendor/golang.org/x/text/encoding/htmlindex/map.go +105 -0
- data/ext/vendor/golang.org/x/text/encoding/htmlindex/tables.go +352 -0
- data/ext/vendor/golang.org/x/text/encoding/ianaindex/example_test.go +27 -0
- data/ext/vendor/golang.org/x/text/encoding/ianaindex/gen.go +192 -0
- data/ext/vendor/golang.org/x/text/encoding/ianaindex/ianaindex.go +209 -0
- data/ext/vendor/golang.org/x/text/encoding/ianaindex/ianaindex_test.go +192 -0
- data/ext/vendor/golang.org/x/text/encoding/ianaindex/tables.go +2348 -0
- data/ext/vendor/golang.org/x/text/encoding/internal/enctest/enctest.go +180 -0
- data/ext/vendor/golang.org/x/text/encoding/internal/identifier/gen.go +137 -0
- data/ext/vendor/golang.org/x/text/encoding/internal/identifier/identifier.go +81 -0
- data/ext/vendor/golang.org/x/text/encoding/internal/identifier/mib.go +1621 -0
- data/ext/vendor/golang.org/x/text/encoding/internal/internal.go +75 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/all.go +12 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/all_test.go +248 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/eucjp.go +225 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/iso2022jp.go +299 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/maketables.go +161 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/shiftjis.go +189 -0
- data/ext/vendor/golang.org/x/text/encoding/japanese/tables.go +26971 -0
- data/ext/vendor/golang.org/x/text/encoding/korean/all_test.go +94 -0
- data/ext/vendor/golang.org/x/text/encoding/korean/euckr.go +177 -0
- data/ext/vendor/golang.org/x/text/encoding/korean/maketables.go +143 -0
- data/ext/vendor/golang.org/x/text/encoding/korean/tables.go +34152 -0
- data/ext/vendor/golang.org/x/text/encoding/simplifiedchinese/all.go +12 -0
- data/ext/vendor/golang.org/x/text/encoding/simplifiedchinese/all_test.go +143 -0
- data/ext/vendor/golang.org/x/text/encoding/simplifiedchinese/gbk.go +269 -0
- data/ext/vendor/golang.org/x/text/encoding/simplifiedchinese/hzgb2312.go +245 -0
- data/ext/vendor/golang.org/x/text/encoding/simplifiedchinese/maketables.go +161 -0
- data/ext/vendor/golang.org/x/text/encoding/simplifiedchinese/tables.go +43999 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/candide-gb18030.txt +510 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/candide-utf-16le.txt +0 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/candide-utf-32be.txt +0 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/candide-utf-8.txt +510 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/candide-windows-1252.txt +510 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/rashomon-euc-jp.txt +178 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/rashomon-iso-2022-jp.txt +178 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/rashomon-shift-jis.txt +178 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/rashomon-utf-8.txt +178 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-gb-levels-1-and-2-hz-gb2312.txt +107 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-gb-levels-1-and-2-utf-8.txt +107 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-simplified-gbk.txt +107 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-simplified-utf-8.txt +107 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-traditional-big5.txt +106 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/sunzi-bingfa-traditional-utf-8.txt +106 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/unsu-joh-eun-nal-euc-kr.txt +175 -0
- data/ext/vendor/golang.org/x/text/encoding/testdata/unsu-joh-eun-nal-utf-8.txt +175 -0
- data/ext/vendor/golang.org/x/text/encoding/traditionalchinese/all_test.go +114 -0
- data/ext/vendor/golang.org/x/text/encoding/traditionalchinese/big5.go +199 -0
- data/ext/vendor/golang.org/x/text/encoding/traditionalchinese/maketables.go +140 -0
- data/ext/vendor/golang.org/x/text/encoding/traditionalchinese/tables.go +37142 -0
- data/ext/vendor/golang.org/x/text/encoding/unicode/override.go +82 -0
- data/ext/vendor/golang.org/x/text/encoding/unicode/unicode.go +434 -0
- data/ext/vendor/golang.org/x/text/encoding/unicode/unicode_test.go +499 -0
- data/ext/vendor/golang.org/x/text/encoding/unicode/utf32/utf32.go +296 -0
- data/ext/vendor/golang.org/x/text/encoding/unicode/utf32/utf32_test.go +248 -0
- data/ext/vendor/golang.org/x/text/feature/plural/common.go +70 -0
- data/ext/vendor/golang.org/x/text/feature/plural/data_test.go +190 -0
- data/ext/vendor/golang.org/x/text/feature/plural/example_test.go +46 -0
- data/ext/vendor/golang.org/x/text/feature/plural/gen.go +513 -0
- data/ext/vendor/golang.org/x/text/feature/plural/gen_common.go +74 -0
- data/ext/vendor/golang.org/x/text/feature/plural/message.go +244 -0
- data/ext/vendor/golang.org/x/text/feature/plural/message_test.go +197 -0
- data/ext/vendor/golang.org/x/text/feature/plural/plural.go +258 -0
- data/ext/vendor/golang.org/x/text/feature/plural/plural_test.go +216 -0
- data/ext/vendor/golang.org/x/text/feature/plural/tables.go +540 -0
- data/ext/vendor/golang.org/x/text/gen.go +318 -0
- data/ext/vendor/golang.org/x/text/internal/catmsg/catmsg.go +366 -0
- data/ext/vendor/golang.org/x/text/internal/catmsg/catmsg_test.go +316 -0
- data/ext/vendor/golang.org/x/text/internal/catmsg/codec.go +407 -0
- data/ext/vendor/golang.org/x/text/internal/catmsg/varint.go +62 -0
- data/ext/vendor/golang.org/x/text/internal/catmsg/varint_test.go +123 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/collate_test.go +121 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/collelem.go +371 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/collelem_test.go +183 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/colltab.go +105 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/colltab_test.go +64 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/contract.go +145 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/contract_test.go +131 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/iter.go +178 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/iter_test.go +63 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/numeric.go +236 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/numeric_test.go +159 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/table.go +275 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/trie.go +159 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/trie_test.go +106 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/weighter.go +31 -0
- data/ext/vendor/golang.org/x/text/internal/colltab/weighter_test.go +42 -0
- data/ext/vendor/golang.org/x/text/internal/export/README +4 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/common_test.go +55 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/example_test.go +68 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/gen.go +276 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/gen_common.go +59 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/gen_test.go +91 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/gen_trieval.go +123 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/idna.go +717 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/idna_test.go +308 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/punycode.go +201 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/punycode_test.go +198 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/tables.go +4557 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/trie.go +70 -0
- data/ext/vendor/golang.org/x/text/internal/export/idna/trieval.go +119 -0
- data/ext/vendor/golang.org/x/text/internal/format/format.go +41 -0
- data/ext/vendor/golang.org/x/text/internal/gen.go +52 -0
- data/ext/vendor/golang.org/x/text/internal/gen/code.go +351 -0
- data/ext/vendor/golang.org/x/text/internal/gen/gen.go +281 -0
- data/ext/vendor/golang.org/x/text/internal/gen_test.go +38 -0
- data/ext/vendor/golang.org/x/text/internal/internal.go +51 -0
- data/ext/vendor/golang.org/x/text/internal/internal_test.go +38 -0
- data/ext/vendor/golang.org/x/text/internal/match.go +67 -0
- data/ext/vendor/golang.org/x/text/internal/match_test.go +56 -0
- data/ext/vendor/golang.org/x/text/internal/number/common.go +40 -0
- data/ext/vendor/golang.org/x/text/internal/number/decimal.go +498 -0
- data/ext/vendor/golang.org/x/text/internal/number/decimal_test.go +329 -0
- data/ext/vendor/golang.org/x/text/internal/number/format.go +540 -0
- data/ext/vendor/golang.org/x/text/internal/number/format_test.go +522 -0
- data/ext/vendor/golang.org/x/text/internal/number/gen.go +458 -0
- data/ext/vendor/golang.org/x/text/internal/number/gen_common.go +44 -0
- data/ext/vendor/golang.org/x/text/internal/number/number.go +154 -0
- data/ext/vendor/golang.org/x/text/internal/number/number_test.go +100 -0
- data/ext/vendor/golang.org/x/text/internal/number/pattern.go +485 -0
- data/ext/vendor/golang.org/x/text/internal/number/pattern_test.go +438 -0
- data/ext/vendor/golang.org/x/text/internal/number/roundingmode_string.go +16 -0
- data/ext/vendor/golang.org/x/text/internal/number/tables.go +1154 -0
- data/ext/vendor/golang.org/x/text/internal/number/tables_test.go +125 -0
- data/ext/vendor/golang.org/x/text/internal/stringset/set.go +86 -0
- data/ext/vendor/golang.org/x/text/internal/stringset/set_test.go +53 -0
- data/ext/vendor/golang.org/x/text/internal/tables.go +117 -0
- data/ext/vendor/golang.org/x/text/internal/tag/tag.go +100 -0
- data/ext/vendor/golang.org/x/text/internal/tag/tag_test.go +67 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/codesize.go +53 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/flag.go +22 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/gc.go +14 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/gccgo.go +11 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/go1_6.go +23 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/go1_7.go +17 -0
- data/ext/vendor/golang.org/x/text/internal/testtext/text.go +105 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/compact.go +58 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/data_test.go +875 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/example_compact_test.go +71 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/example_test.go +148 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/gen_test.go +68 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/print.go +251 -0
- data/ext/vendor/golang.org/x/text/internal/triegen/triegen.go +494 -0
- data/ext/vendor/golang.org/x/text/internal/ucd/example_test.go +81 -0
- data/ext/vendor/golang.org/x/text/internal/ucd/ucd.go +371 -0
- data/ext/vendor/golang.org/x/text/internal/ucd/ucd_test.go +105 -0
- data/ext/vendor/golang.org/x/text/internal/utf8internal/utf8internal.go +87 -0
- data/ext/vendor/golang.org/x/text/language/Makefile +16 -0
- data/ext/vendor/golang.org/x/text/language/common.go +16 -0
- data/ext/vendor/golang.org/x/text/language/coverage.go +197 -0
- data/ext/vendor/golang.org/x/text/language/coverage_test.go +154 -0
- data/ext/vendor/golang.org/x/text/language/display/dict.go +92 -0
- data/ext/vendor/golang.org/x/text/language/display/dict_test.go +39 -0
- data/ext/vendor/golang.org/x/text/language/display/display.go +420 -0
- data/ext/vendor/golang.org/x/text/language/display/display_test.go +705 -0
- data/ext/vendor/golang.org/x/text/language/display/examples_test.go +116 -0
- data/ext/vendor/golang.org/x/text/language/display/lookup.go +251 -0
- data/ext/vendor/golang.org/x/text/language/display/maketables.go +602 -0
- data/ext/vendor/golang.org/x/text/language/display/tables.go +50344 -0
- data/ext/vendor/golang.org/x/text/language/doc.go +102 -0
- data/ext/vendor/golang.org/x/text/language/examples_test.go +413 -0
- data/ext/vendor/golang.org/x/text/language/gen.go +1706 -0
- data/ext/vendor/golang.org/x/text/language/gen_common.go +20 -0
- data/ext/vendor/golang.org/x/text/language/gen_index.go +162 -0
- data/ext/vendor/golang.org/x/text/language/go1_1.go +38 -0
- data/ext/vendor/golang.org/x/text/language/go1_2.go +11 -0
- data/ext/vendor/golang.org/x/text/language/httpexample_test.go +48 -0
- data/ext/vendor/golang.org/x/text/language/index.go +769 -0
- data/ext/vendor/golang.org/x/text/language/language.go +887 -0
- data/ext/vendor/golang.org/x/text/language/language_test.go +878 -0
- data/ext/vendor/golang.org/x/text/language/lookup.go +396 -0
- data/ext/vendor/golang.org/x/text/language/lookup_test.go +457 -0
- data/ext/vendor/golang.org/x/text/language/match.go +933 -0
- data/ext/vendor/golang.org/x/text/language/match_test.go +505 -0
- data/ext/vendor/golang.org/x/text/language/parse.go +859 -0
- data/ext/vendor/golang.org/x/text/language/parse_test.go +517 -0
- data/ext/vendor/golang.org/x/text/language/tables.go +3675 -0
- data/ext/vendor/golang.org/x/text/language/tags.go +143 -0
- data/ext/vendor/golang.org/x/text/language/testdata/CLDRLocaleMatcherTest.txt +389 -0
- data/ext/vendor/golang.org/x/text/language/testdata/GoLocaleMatcherTest.txt +226 -0
- data/ext/vendor/golang.org/x/text/message/catalog.go +28 -0
- data/ext/vendor/golang.org/x/text/message/catalog/catalog.go +292 -0
- data/ext/vendor/golang.org/x/text/message/catalog/catalog_test.go +194 -0
- data/ext/vendor/golang.org/x/text/message/catalog/dict.go +90 -0
- data/ext/vendor/golang.org/x/text/message/doc.go +100 -0
- data/ext/vendor/golang.org/x/text/message/examples_test.go +42 -0
- data/ext/vendor/golang.org/x/text/message/fmt_test.go +1889 -0
- data/ext/vendor/golang.org/x/text/message/format.go +532 -0
- data/ext/vendor/golang.org/x/text/message/message.go +169 -0
- data/ext/vendor/golang.org/x/text/message/message_test.go +181 -0
- data/ext/vendor/golang.org/x/text/message/print.go +1194 -0
- data/ext/vendor/golang.org/x/text/number/doc.go +28 -0
- data/ext/vendor/golang.org/x/text/number/examples_test.go +28 -0
- data/ext/vendor/golang.org/x/text/number/format.go +122 -0
- data/ext/vendor/golang.org/x/text/number/format_test.go +107 -0
- data/ext/vendor/golang.org/x/text/number/number.go +77 -0
- data/ext/vendor/golang.org/x/text/number/number_test.go +190 -0
- data/ext/vendor/golang.org/x/text/number/option.go +177 -0
- data/ext/vendor/golang.org/x/text/runes/cond.go +187 -0
- data/ext/vendor/golang.org/x/text/runes/cond_test.go +282 -0
- data/ext/vendor/golang.org/x/text/runes/example_test.go +60 -0
- data/ext/vendor/golang.org/x/text/runes/runes.go +355 -0
- data/ext/vendor/golang.org/x/text/runes/runes_test.go +664 -0
- data/ext/vendor/golang.org/x/text/search/index.go +35 -0
- data/ext/vendor/golang.org/x/text/search/pattern.go +155 -0
- data/ext/vendor/golang.org/x/text/search/pattern_test.go +357 -0
- data/ext/vendor/golang.org/x/text/search/search.go +237 -0
- data/ext/vendor/golang.org/x/text/search/tables.go +12448 -0
- data/ext/vendor/golang.org/x/text/secure/bidirule/bench_test.go +54 -0
- data/ext/vendor/golang.org/x/text/secure/bidirule/bidirule.go +340 -0
- data/ext/vendor/golang.org/x/text/secure/bidirule/bidirule_test.go +851 -0
- data/ext/vendor/golang.org/x/text/secure/doc.go +6 -0
- data/ext/vendor/golang.org/x/text/secure/precis/benchmark_test.go +82 -0
- data/ext/vendor/golang.org/x/text/secure/precis/class.go +36 -0
- data/ext/vendor/golang.org/x/text/secure/precis/class_test.go +50 -0
- data/ext/vendor/golang.org/x/text/secure/precis/context.go +139 -0
- data/ext/vendor/golang.org/x/text/secure/precis/doc.go +14 -0
- data/ext/vendor/golang.org/x/text/secure/precis/enforce_test.go +396 -0
- data/ext/vendor/golang.org/x/text/secure/precis/gen.go +310 -0
- data/ext/vendor/golang.org/x/text/secure/precis/gen_trieval.go +68 -0
- data/ext/vendor/golang.org/x/text/secure/precis/nickname.go +72 -0
- data/ext/vendor/golang.org/x/text/secure/precis/options.go +157 -0
- data/ext/vendor/golang.org/x/text/secure/precis/profile.go +402 -0
- data/ext/vendor/golang.org/x/text/secure/precis/profile_test.go +149 -0
- data/ext/vendor/golang.org/x/text/secure/precis/profiles.go +78 -0
- data/ext/vendor/golang.org/x/text/secure/precis/tables.go +3887 -0
- data/ext/vendor/golang.org/x/text/secure/precis/tables_test.go +69 -0
- data/ext/vendor/golang.org/x/text/secure/precis/transformer.go +32 -0
- data/ext/vendor/golang.org/x/text/secure/precis/trieval.go +64 -0
- data/ext/vendor/golang.org/x/text/transform/examples_test.go +37 -0
- data/ext/vendor/golang.org/x/text/transform/transform.go +705 -0
- data/ext/vendor/golang.org/x/text/transform/transform_test.go +1317 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/bidi.go +198 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/bracket.go +335 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/core.go +1058 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/core_test.go +224 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/gen.go +133 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/gen_ranges.go +57 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/gen_trieval.go +64 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/prop.go +206 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/ranges_test.go +53 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/tables.go +1813 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/tables_test.go +82 -0
- data/ext/vendor/golang.org/x/text/unicode/bidi/trieval.go +60 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/base.go +100 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/cldr.go +130 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/cldr_test.go +27 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/collate.go +359 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/collate_test.go +275 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/data_test.go +186 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/decode.go +171 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/examples_test.go +21 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/makexml.go +400 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/resolve.go +602 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/resolve_test.go +368 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/slice.go +144 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/slice_test.go +175 -0
- data/ext/vendor/golang.org/x/text/unicode/cldr/xml.go +1487 -0
- data/ext/vendor/golang.org/x/text/unicode/doc.go +8 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/composition.go +508 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/composition_test.go +130 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/example_iter_test.go +82 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/example_test.go +27 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/forminfo.go +259 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/forminfo_test.go +54 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/input.go +109 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/iter.go +457 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/iter_test.go +98 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/maketables.go +976 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/norm_test.go +14 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/normalize.go +609 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/normalize_test.go +1287 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/readwriter.go +125 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/readwriter_test.go +56 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/tables.go +7651 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/transform.go +88 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/transform_test.go +101 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/trie.go +54 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/triegen.go +117 -0
- data/ext/vendor/golang.org/x/text/unicode/norm/ucd_test.go +275 -0
- data/ext/vendor/golang.org/x/text/unicode/rangetable/gen.go +115 -0
- data/ext/vendor/golang.org/x/text/unicode/rangetable/merge.go +260 -0
- data/ext/vendor/golang.org/x/text/unicode/rangetable/merge_test.go +184 -0
- data/ext/vendor/golang.org/x/text/unicode/rangetable/rangetable.go +70 -0
- data/ext/vendor/golang.org/x/text/unicode/rangetable/rangetable_test.go +55 -0
- data/ext/vendor/golang.org/x/text/unicode/rangetable/tables.go +6376 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/bits.go +59 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/example_test.go +118 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/gen.go +195 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/gen_bits.go +63 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/runenames.go +48 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/runenames_test.go +46 -0
- data/ext/vendor/golang.org/x/text/unicode/runenames/tables.go +15514 -0
- data/ext/vendor/golang.org/x/text/width/common_test.go +92 -0
- data/ext/vendor/golang.org/x/text/width/example_test.go +52 -0
- data/ext/vendor/golang.org/x/text/width/gen.go +115 -0
- data/ext/vendor/golang.org/x/text/width/gen_common.go +96 -0
- data/ext/vendor/golang.org/x/text/width/gen_trieval.go +34 -0
- data/ext/vendor/golang.org/x/text/width/kind_string.go +16 -0
- data/ext/vendor/golang.org/x/text/width/runes_test.go +461 -0
- data/ext/vendor/golang.org/x/text/width/tables.go +1316 -0
- data/ext/vendor/golang.org/x/text/width/tables_test.go +59 -0
- data/ext/vendor/golang.org/x/text/width/transform.go +239 -0
- data/ext/vendor/golang.org/x/text/width/transform_test.go +701 -0
- data/ext/vendor/golang.org/x/text/width/trieval.go +30 -0
- data/ext/vendor/golang.org/x/text/width/width.go +206 -0
- data/lib/ires/version.rb +1 -1
- data/shared/darwin/ires.so +0 -0
- data/shared/linux/ires.so +0 -0
- metadata +1011 -23
- data/ext/operate/image.go +0 -176
- data/ext/util/uri/uri.go +0 -105
- data/ext/vendor/github.com/satori/go.uuid/README.md +0 -65
- data/ext/vendor/github.com/satori/go.uuid/benchmarks_test.go +0 -121
- data/ext/vendor/github.com/satori/go.uuid/uuid.go +0 -488
- data/ext/vendor/github.com/satori/go.uuid/uuid_test.go +0 -633
@@ -0,0 +1,1287 @@
|
|
1
|
+
// Copyright 2011 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.
|
4
|
+
|
5
|
+
package norm
|
6
|
+
|
7
|
+
import (
|
8
|
+
"bytes"
|
9
|
+
"flag"
|
10
|
+
"fmt"
|
11
|
+
"io"
|
12
|
+
"log"
|
13
|
+
"strings"
|
14
|
+
"testing"
|
15
|
+
"unicode/utf8"
|
16
|
+
|
17
|
+
"golang.org/x/text/internal/testtext"
|
18
|
+
"golang.org/x/text/transform"
|
19
|
+
)
|
20
|
+
|
21
|
+
var (
|
22
|
+
testn = flag.Int("testn", -1, "specific test number to run or -1 for all")
|
23
|
+
)
|
24
|
+
|
25
|
+
// pc replaces any rune r that is repeated n times, for n > 1, with r{n}.
|
26
|
+
func pc(s string) []byte {
|
27
|
+
b := bytes.NewBuffer(make([]byte, 0, len(s)))
|
28
|
+
for i := 0; i < len(s); {
|
29
|
+
r, sz := utf8.DecodeRuneInString(s[i:])
|
30
|
+
n := 0
|
31
|
+
if sz == 1 {
|
32
|
+
// Special-case one-byte case to handle repetition for invalid UTF-8.
|
33
|
+
for c := s[i]; i+n < len(s) && s[i+n] == c; n++ {
|
34
|
+
}
|
35
|
+
} else {
|
36
|
+
for _, r2 := range s[i:] {
|
37
|
+
if r2 != r {
|
38
|
+
break
|
39
|
+
}
|
40
|
+
n++
|
41
|
+
}
|
42
|
+
}
|
43
|
+
b.WriteString(s[i : i+sz])
|
44
|
+
if n > 1 {
|
45
|
+
fmt.Fprintf(b, "{%d}", n)
|
46
|
+
}
|
47
|
+
i += sz * n
|
48
|
+
}
|
49
|
+
return b.Bytes()
|
50
|
+
}
|
51
|
+
|
52
|
+
// pidx finds the index from which two strings start to differ, plus context.
|
53
|
+
// It returns the index and ellipsis if the index is greater than 0.
|
54
|
+
func pidx(a, b string) (i int, prefix string) {
|
55
|
+
for ; i < len(a) && i < len(b) && a[i] == b[i]; i++ {
|
56
|
+
}
|
57
|
+
if i < 8 {
|
58
|
+
return 0, ""
|
59
|
+
}
|
60
|
+
i -= 3 // ensure taking at least one full rune before the difference.
|
61
|
+
for k := i - 7; i > k && !utf8.RuneStart(a[i]); i-- {
|
62
|
+
}
|
63
|
+
return i, "..."
|
64
|
+
}
|
65
|
+
|
66
|
+
type PositionTest struct {
|
67
|
+
input string
|
68
|
+
pos int
|
69
|
+
buffer string // expected contents of reorderBuffer, if applicable
|
70
|
+
}
|
71
|
+
|
72
|
+
type positionFunc func(rb *reorderBuffer, s string) (int, []byte)
|
73
|
+
|
74
|
+
func runPosTests(t *testing.T, name string, f Form, fn positionFunc, tests []PositionTest) {
|
75
|
+
rb := reorderBuffer{}
|
76
|
+
rb.init(f, nil)
|
77
|
+
for i, test := range tests {
|
78
|
+
rb.reset()
|
79
|
+
rb.src = inputString(test.input)
|
80
|
+
rb.nsrc = len(test.input)
|
81
|
+
pos, out := fn(&rb, test.input)
|
82
|
+
if pos != test.pos {
|
83
|
+
t.Errorf("%s:%d: position is %d; want %d", name, i, pos, test.pos)
|
84
|
+
}
|
85
|
+
if outs := string(out); outs != test.buffer {
|
86
|
+
k, pfx := pidx(outs, test.buffer)
|
87
|
+
t.Errorf("%s:%d: buffer \nwas %s%+q; \nwant %s%+q", name, i, pfx, pc(outs[k:]), pfx, pc(test.buffer[k:]))
|
88
|
+
}
|
89
|
+
}
|
90
|
+
}
|
91
|
+
|
92
|
+
func grave(n int) string {
|
93
|
+
return rep(0x0300, n)
|
94
|
+
}
|
95
|
+
|
96
|
+
func rep(r rune, n int) string {
|
97
|
+
return strings.Repeat(string(r), n)
|
98
|
+
}
|
99
|
+
|
100
|
+
const segSize = maxByteBufferSize
|
101
|
+
|
102
|
+
var cgj = GraphemeJoiner
|
103
|
+
|
104
|
+
var decomposeSegmentTests = []PositionTest{
|
105
|
+
// illegal runes
|
106
|
+
{"\xC2", 0, ""},
|
107
|
+
{"\xC0", 1, "\xC0"},
|
108
|
+
{"\u00E0\x80", 2, "\u0061\u0300"},
|
109
|
+
// starter
|
110
|
+
{"a", 1, "a"},
|
111
|
+
{"ab", 1, "a"},
|
112
|
+
// starter + composing
|
113
|
+
{"a\u0300", 3, "a\u0300"},
|
114
|
+
{"a\u0300b", 3, "a\u0300"},
|
115
|
+
// with decomposition
|
116
|
+
{"\u00C0", 2, "A\u0300"},
|
117
|
+
{"\u00C0b", 2, "A\u0300"},
|
118
|
+
// long
|
119
|
+
{grave(31), 60, grave(30) + cgj},
|
120
|
+
{"a" + grave(31), 61, "a" + grave(30) + cgj},
|
121
|
+
|
122
|
+
// Stability tests: see http://www.unicode.org/review/pr-29.html.
|
123
|
+
// U+0300 COMBINING GRAVE ACCENT;Mn;230;NSM;;;;;N;NON-SPACING GRAVE;;;;
|
124
|
+
// U+0B47 ORIYA VOWEL SIGN E;Mc;0;L;;;;;N;;;;;
|
125
|
+
// U+0B3E ORIYA VOWEL SIGN AA;Mc;0;L;;;;;N;;;;;
|
126
|
+
// U+1100 HANGUL CHOSEONG KIYEOK;Lo;0;L;;;;;N;;;;;
|
127
|
+
// U+1161 HANGUL JUNGSEONG A;Lo;0;L;;;;;N;;;;;
|
128
|
+
{"\u0B47\u0300\u0B3E", 8, "\u0B47\u0300\u0B3E"},
|
129
|
+
{"\u1100\u0300\u1161", 8, "\u1100\u0300\u1161"},
|
130
|
+
{"\u0B47\u0B3E", 6, "\u0B47\u0B3E"},
|
131
|
+
{"\u1100\u1161", 6, "\u1100\u1161"},
|
132
|
+
|
133
|
+
// U+04DA MALAYALAM VOWEL SIGN O;Mc;0;L;0D46 0D3E;;;;N;;;;;
|
134
|
+
// Sequence of decomposing characters that are starters and modifiers.
|
135
|
+
{"\u0d4a" + strings.Repeat("\u0d3e", 31), 90, "\u0d46" + strings.Repeat("\u0d3e", 30) + cgj},
|
136
|
+
|
137
|
+
{grave(30), 60, grave(30)},
|
138
|
+
// U+FF9E is a starter, but decomposes to U+3099, which is not.
|
139
|
+
{grave(30) + "\uff9e", 60, grave(30) + cgj},
|
140
|
+
// ends with incomplete UTF-8 encoding
|
141
|
+
{"\xCC", 0, ""},
|
142
|
+
{"\u0300\xCC", 2, "\u0300"},
|
143
|
+
}
|
144
|
+
|
145
|
+
func decomposeSegmentF(rb *reorderBuffer, s string) (int, []byte) {
|
146
|
+
rb.initString(NFD, s)
|
147
|
+
rb.setFlusher(nil, appendFlush)
|
148
|
+
p := decomposeSegment(rb, 0, true)
|
149
|
+
return p, rb.out
|
150
|
+
}
|
151
|
+
|
152
|
+
func TestDecomposeSegment(t *testing.T) {
|
153
|
+
runPosTests(t, "TestDecomposeSegment", NFC, decomposeSegmentF, decomposeSegmentTests)
|
154
|
+
}
|
155
|
+
|
156
|
+
var firstBoundaryTests = []PositionTest{
|
157
|
+
// no boundary
|
158
|
+
{"", -1, ""},
|
159
|
+
{"\u0300", -1, ""},
|
160
|
+
{"\x80\x80", -1, ""},
|
161
|
+
// illegal runes
|
162
|
+
{"\xff", 0, ""},
|
163
|
+
{"\u0300\xff", 2, ""},
|
164
|
+
{"\u0300\xc0\x80\x80", 2, ""},
|
165
|
+
// boundaries
|
166
|
+
{"a", 0, ""},
|
167
|
+
{"\u0300a", 2, ""},
|
168
|
+
// Hangul
|
169
|
+
{"\u1103\u1161", 0, ""},
|
170
|
+
{"\u110B\u1173\u11B7", 0, ""},
|
171
|
+
{"\u1161\u110B\u1173\u11B7", 3, ""},
|
172
|
+
{"\u1173\u11B7\u1103\u1161", 6, ""},
|
173
|
+
// too many combining characters.
|
174
|
+
{grave(maxNonStarters - 1), -1, ""},
|
175
|
+
{grave(maxNonStarters), 60, ""},
|
176
|
+
{grave(maxNonStarters + 1), 60, ""},
|
177
|
+
}
|
178
|
+
|
179
|
+
func firstBoundaryF(rb *reorderBuffer, s string) (int, []byte) {
|
180
|
+
return rb.f.form.FirstBoundary([]byte(s)), nil
|
181
|
+
}
|
182
|
+
|
183
|
+
func firstBoundaryStringF(rb *reorderBuffer, s string) (int, []byte) {
|
184
|
+
return rb.f.form.FirstBoundaryInString(s), nil
|
185
|
+
}
|
186
|
+
|
187
|
+
func TestFirstBoundary(t *testing.T) {
|
188
|
+
runPosTests(t, "TestFirstBoundary", NFC, firstBoundaryF, firstBoundaryTests)
|
189
|
+
runPosTests(t, "TestFirstBoundaryInString", NFC, firstBoundaryStringF, firstBoundaryTests)
|
190
|
+
}
|
191
|
+
|
192
|
+
func TestNextBoundary(t *testing.T) {
|
193
|
+
testCases := []struct {
|
194
|
+
input string
|
195
|
+
atEOF bool
|
196
|
+
want int
|
197
|
+
}{
|
198
|
+
// no boundary
|
199
|
+
{"", true, 0},
|
200
|
+
{"", false, -1},
|
201
|
+
{"\u0300", true, 2},
|
202
|
+
{"\u0300", false, -1},
|
203
|
+
{"\x80\x80", true, 1},
|
204
|
+
{"\x80\x80", false, 1},
|
205
|
+
// illegal runes
|
206
|
+
{"\xff", false, 1},
|
207
|
+
{"\u0300\xff", false, 2},
|
208
|
+
{"\u0300\xc0\x80\x80", false, 2},
|
209
|
+
{"\xc2\x80\x80", false, 2},
|
210
|
+
{"\xc2", false, -1},
|
211
|
+
{"\xc2", true, 1},
|
212
|
+
{"a\u0300\xc2", false, -1},
|
213
|
+
{"a\u0300\xc2", true, 3},
|
214
|
+
// boundaries
|
215
|
+
{"a", true, 1},
|
216
|
+
{"a", false, -1},
|
217
|
+
{"aa", false, 1},
|
218
|
+
{"\u0300", true, 2},
|
219
|
+
{"\u0300", false, -1},
|
220
|
+
{"\u0300a", false, 2},
|
221
|
+
// Hangul
|
222
|
+
{"\u1103\u1161", true, 6},
|
223
|
+
{"\u1103\u1161", false, -1},
|
224
|
+
{"\u110B\u1173\u11B7", false, -1},
|
225
|
+
{"\u110B\u1173\u11B7\u110B\u1173\u11B7", false, 9},
|
226
|
+
{"\u1161\u110B\u1173\u11B7", false, 3},
|
227
|
+
{"\u1173\u11B7\u1103\u1161", false, 6},
|
228
|
+
// too many combining characters.
|
229
|
+
{grave(maxNonStarters - 1), false, -1},
|
230
|
+
{grave(maxNonStarters), false, 60},
|
231
|
+
{grave(maxNonStarters + 1), false, 60},
|
232
|
+
}
|
233
|
+
|
234
|
+
for _, tc := range testCases {
|
235
|
+
if got := NFC.NextBoundary([]byte(tc.input), tc.atEOF); got != tc.want {
|
236
|
+
t.Errorf("NextBoundary(%+q, %v) = %d; want %d", tc.input, tc.atEOF, got, tc.want)
|
237
|
+
}
|
238
|
+
if got := NFC.NextBoundaryInString(tc.input, tc.atEOF); got != tc.want {
|
239
|
+
t.Errorf("NextBoundaryInString(%+q, %v) = %d; want %d", tc.input, tc.atEOF, got, tc.want)
|
240
|
+
}
|
241
|
+
}
|
242
|
+
}
|
243
|
+
|
244
|
+
var decomposeToLastTests = []PositionTest{
|
245
|
+
// ends with inert character
|
246
|
+
{"Hello!", 6, ""},
|
247
|
+
{"\u0632", 2, ""},
|
248
|
+
{"a\u0301\u0635", 5, ""},
|
249
|
+
// ends with non-inert starter
|
250
|
+
{"a", 0, "a"},
|
251
|
+
{"a\u0301a", 3, "a"},
|
252
|
+
{"a\u0301\u03B9", 3, "\u03B9"},
|
253
|
+
{"a\u0327", 0, "a\u0327"},
|
254
|
+
// illegal runes
|
255
|
+
{"\xFF", 1, ""},
|
256
|
+
{"aa\xFF", 3, ""},
|
257
|
+
{"\xC0\x80\x80", 3, ""},
|
258
|
+
{"\xCC\x80\x80", 3, ""},
|
259
|
+
// ends with incomplete UTF-8 encoding
|
260
|
+
{"a\xCC", 2, ""},
|
261
|
+
// ends with combining characters
|
262
|
+
{"\u0300\u0301", 0, "\u0300\u0301"},
|
263
|
+
{"a\u0300\u0301", 0, "a\u0300\u0301"},
|
264
|
+
{"a\u0301\u0308", 0, "a\u0301\u0308"},
|
265
|
+
{"a\u0308\u0301", 0, "a\u0308\u0301"},
|
266
|
+
{"aaaa\u0300\u0301", 3, "a\u0300\u0301"},
|
267
|
+
{"\u0300a\u0300\u0301", 2, "a\u0300\u0301"},
|
268
|
+
{"\u00C0", 0, "A\u0300"},
|
269
|
+
{"a\u00C0", 1, "A\u0300"},
|
270
|
+
// decomposing
|
271
|
+
{"a\u0300\u00E0", 3, "a\u0300"},
|
272
|
+
// multisegment decompositions (flushes leading segments)
|
273
|
+
{"a\u0300\uFDC0", 7, "\u064A"},
|
274
|
+
{"\uFDC0" + grave(29), 4, "\u064A" + grave(29)},
|
275
|
+
{"\uFDC0" + grave(30), 4, "\u064A" + grave(30)},
|
276
|
+
{"\uFDC0" + grave(31), 5, grave(30)},
|
277
|
+
{"\uFDFA" + grave(14), 31, "\u0645" + grave(14)},
|
278
|
+
// Overflow
|
279
|
+
{"\u00E0" + grave(29), 0, "a" + grave(30)},
|
280
|
+
{"\u00E0" + grave(30), 2, grave(30)},
|
281
|
+
// Hangul
|
282
|
+
{"a\u1103", 1, "\u1103"},
|
283
|
+
{"a\u110B", 1, "\u110B"},
|
284
|
+
{"a\u110B\u1173", 1, "\u110B\u1173"},
|
285
|
+
// See comment in composition.go:compBoundaryAfter.
|
286
|
+
{"a\u110B\u1173\u11B7", 1, "\u110B\u1173\u11B7"},
|
287
|
+
{"a\uC73C", 1, "\u110B\u1173"},
|
288
|
+
{"다음", 3, "\u110B\u1173\u11B7"},
|
289
|
+
{"다", 0, "\u1103\u1161"},
|
290
|
+
{"\u1103\u1161\u110B\u1173\u11B7", 6, "\u110B\u1173\u11B7"},
|
291
|
+
{"\u110B\u1173\u11B7\u1103\u1161", 9, "\u1103\u1161"},
|
292
|
+
{"다음음", 6, "\u110B\u1173\u11B7"},
|
293
|
+
{"음다다", 6, "\u1103\u1161"},
|
294
|
+
// maximized buffer
|
295
|
+
{"a" + grave(30), 0, "a" + grave(30)},
|
296
|
+
// Buffer overflow
|
297
|
+
{"a" + grave(31), 3, grave(30)},
|
298
|
+
// weird UTF-8
|
299
|
+
{"a\u0300\u11B7", 0, "a\u0300\u11B7"},
|
300
|
+
}
|
301
|
+
|
302
|
+
func decomposeToLast(rb *reorderBuffer, s string) (int, []byte) {
|
303
|
+
rb.setFlusher([]byte(s), appendFlush)
|
304
|
+
decomposeToLastBoundary(rb)
|
305
|
+
buf := rb.flush(nil)
|
306
|
+
return len(rb.out), buf
|
307
|
+
}
|
308
|
+
|
309
|
+
func TestDecomposeToLastBoundary(t *testing.T) {
|
310
|
+
runPosTests(t, "TestDecomposeToLastBoundary", NFKC, decomposeToLast, decomposeToLastTests)
|
311
|
+
}
|
312
|
+
|
313
|
+
var lastBoundaryTests = []PositionTest{
|
314
|
+
// ends with inert character
|
315
|
+
{"Hello!", 6, ""},
|
316
|
+
{"\u0632", 2, ""},
|
317
|
+
// ends with non-inert starter
|
318
|
+
{"a", 0, ""},
|
319
|
+
// illegal runes
|
320
|
+
{"\xff", 1, ""},
|
321
|
+
{"aa\xff", 3, ""},
|
322
|
+
{"a\xff\u0300", 1, ""}, // TODO: should probably be 2.
|
323
|
+
{"\xc0\x80\x80", 3, ""},
|
324
|
+
{"\xc0\x80\x80\u0300", 3, ""},
|
325
|
+
// ends with incomplete UTF-8 encoding
|
326
|
+
{"\xCC", -1, ""},
|
327
|
+
{"\xE0\x80", -1, ""},
|
328
|
+
{"\xF0\x80\x80", -1, ""},
|
329
|
+
{"a\xCC", 0, ""},
|
330
|
+
{"\x80\xCC", 1, ""},
|
331
|
+
{"\xCC\xCC", 1, ""},
|
332
|
+
// ends with combining characters
|
333
|
+
{"a\u0300\u0301", 0, ""},
|
334
|
+
{"aaaa\u0300\u0301", 3, ""},
|
335
|
+
{"\u0300a\u0300\u0301", 2, ""},
|
336
|
+
{"\u00C2", 0, ""},
|
337
|
+
{"a\u00C2", 1, ""},
|
338
|
+
// decomposition may recombine
|
339
|
+
{"\u0226", 0, ""},
|
340
|
+
// no boundary
|
341
|
+
{"", -1, ""},
|
342
|
+
{"\u0300\u0301", -1, ""},
|
343
|
+
{"\u0300", -1, ""},
|
344
|
+
{"\x80\x80", -1, ""},
|
345
|
+
{"\x80\x80\u0301", -1, ""},
|
346
|
+
// Hangul
|
347
|
+
{"다음", 3, ""},
|
348
|
+
{"다", 0, ""},
|
349
|
+
{"\u1103\u1161\u110B\u1173\u11B7", 6, ""},
|
350
|
+
{"\u110B\u1173\u11B7\u1103\u1161", 9, ""},
|
351
|
+
// too many combining characters.
|
352
|
+
{grave(maxNonStarters - 1), -1, ""},
|
353
|
+
// May still be preceded with a non-starter.
|
354
|
+
{grave(maxNonStarters), -1, ""},
|
355
|
+
// May still need to insert a cgj after the last combiner.
|
356
|
+
{grave(maxNonStarters + 1), 2, ""},
|
357
|
+
{grave(maxNonStarters + 2), 4, ""},
|
358
|
+
|
359
|
+
{"a" + grave(maxNonStarters-1), 0, ""},
|
360
|
+
{"a" + grave(maxNonStarters), 0, ""},
|
361
|
+
// May still need to insert a cgj after the last combiner.
|
362
|
+
{"a" + grave(maxNonStarters+1), 3, ""},
|
363
|
+
{"a" + grave(maxNonStarters+2), 5, ""},
|
364
|
+
}
|
365
|
+
|
366
|
+
func lastBoundaryF(rb *reorderBuffer, s string) (int, []byte) {
|
367
|
+
return rb.f.form.LastBoundary([]byte(s)), nil
|
368
|
+
}
|
369
|
+
|
370
|
+
func TestLastBoundary(t *testing.T) {
|
371
|
+
runPosTests(t, "TestLastBoundary", NFC, lastBoundaryF, lastBoundaryTests)
|
372
|
+
}
|
373
|
+
|
374
|
+
type spanTest struct {
|
375
|
+
input string
|
376
|
+
atEOF bool
|
377
|
+
n int
|
378
|
+
err error
|
379
|
+
}
|
380
|
+
|
381
|
+
var quickSpanTests = []spanTest{
|
382
|
+
{"", true, 0, nil},
|
383
|
+
// starters
|
384
|
+
{"a", true, 1, nil},
|
385
|
+
{"abc", true, 3, nil},
|
386
|
+
{"\u043Eb", true, 3, nil},
|
387
|
+
// incomplete last rune.
|
388
|
+
{"\xCC", true, 1, nil},
|
389
|
+
{"\xCC", false, 0, transform.ErrShortSrc},
|
390
|
+
{"a\xCC", true, 2, nil},
|
391
|
+
{"a\xCC", false, 0, transform.ErrShortSrc}, // TODO: could be 1 for NFD
|
392
|
+
// incorrectly ordered combining characters
|
393
|
+
{"\u0300\u0316", true, 0, transform.ErrEndOfSpan},
|
394
|
+
{"\u0300\u0316", false, 0, transform.ErrEndOfSpan},
|
395
|
+
{"\u0300\u0316cd", true, 0, transform.ErrEndOfSpan},
|
396
|
+
{"\u0300\u0316cd", false, 0, transform.ErrEndOfSpan},
|
397
|
+
// have a maximum number of combining characters.
|
398
|
+
{rep(0x035D, 30) + "\u035B", true, 0, transform.ErrEndOfSpan},
|
399
|
+
{"a" + rep(0x035D, 30) + "\u035B", true, 0, transform.ErrEndOfSpan},
|
400
|
+
{"Ɵ" + rep(0x035D, 30) + "\u035B", true, 0, transform.ErrEndOfSpan},
|
401
|
+
{"aa" + rep(0x035D, 30) + "\u035B", true, 1, transform.ErrEndOfSpan},
|
402
|
+
{rep(0x035D, 30) + cgj + "\u035B", true, 64, nil},
|
403
|
+
{"a" + rep(0x035D, 30) + cgj + "\u035B", true, 65, nil},
|
404
|
+
{"Ɵ" + rep(0x035D, 30) + cgj + "\u035B", true, 66, nil},
|
405
|
+
{"aa" + rep(0x035D, 30) + cgj + "\u035B", true, 66, nil},
|
406
|
+
|
407
|
+
{"a" + rep(0x035D, 30) + cgj + "\u035B", false, 61, transform.ErrShortSrc},
|
408
|
+
{"Ɵ" + rep(0x035D, 30) + cgj + "\u035B", false, 62, transform.ErrShortSrc},
|
409
|
+
{"aa" + rep(0x035D, 30) + cgj + "\u035B", false, 62, transform.ErrShortSrc},
|
410
|
+
}
|
411
|
+
|
412
|
+
var quickSpanNFDTests = []spanTest{
|
413
|
+
// needs decomposing
|
414
|
+
{"\u00C0", true, 0, transform.ErrEndOfSpan},
|
415
|
+
{"abc\u00C0", true, 3, transform.ErrEndOfSpan},
|
416
|
+
// correctly ordered combining characters
|
417
|
+
{"\u0300", true, 2, nil},
|
418
|
+
{"ab\u0300", true, 4, nil},
|
419
|
+
{"ab\u0300cd", true, 6, nil},
|
420
|
+
{"\u0300cd", true, 4, nil},
|
421
|
+
{"\u0316\u0300", true, 4, nil},
|
422
|
+
{"ab\u0316\u0300", true, 6, nil},
|
423
|
+
{"ab\u0316\u0300cd", true, 8, nil},
|
424
|
+
{"ab\u0316\u0300\u00C0", true, 6, transform.ErrEndOfSpan},
|
425
|
+
{"\u0316\u0300cd", true, 6, nil},
|
426
|
+
{"\u043E\u0308b", true, 5, nil},
|
427
|
+
// incorrectly ordered combining characters
|
428
|
+
{"ab\u0300\u0316", true, 1, transform.ErrEndOfSpan}, // TODO: we could skip 'b' as well.
|
429
|
+
{"ab\u0300\u0316cd", true, 1, transform.ErrEndOfSpan},
|
430
|
+
// Hangul
|
431
|
+
{"같은", true, 0, transform.ErrEndOfSpan},
|
432
|
+
}
|
433
|
+
|
434
|
+
var quickSpanNFCTests = []spanTest{
|
435
|
+
// okay composed
|
436
|
+
{"\u00C0", true, 2, nil},
|
437
|
+
{"abc\u00C0", true, 5, nil},
|
438
|
+
// correctly ordered combining characters
|
439
|
+
// TODO: b may combine with modifiers, which is why this fails. We could
|
440
|
+
// make a more precise test that that actually checks whether last
|
441
|
+
// characters combines. Probably not worth it.
|
442
|
+
{"ab\u0300", true, 1, transform.ErrEndOfSpan},
|
443
|
+
{"ab\u0300cd", true, 1, transform.ErrEndOfSpan},
|
444
|
+
{"ab\u0316\u0300", true, 1, transform.ErrEndOfSpan},
|
445
|
+
{"ab\u0316\u0300cd", true, 1, transform.ErrEndOfSpan},
|
446
|
+
{"\u00C0\u035D", true, 4, nil},
|
447
|
+
// we do not special case leading combining characters
|
448
|
+
{"\u0300cd", true, 0, transform.ErrEndOfSpan},
|
449
|
+
{"\u0300", true, 0, transform.ErrEndOfSpan},
|
450
|
+
{"\u0316\u0300", true, 0, transform.ErrEndOfSpan},
|
451
|
+
{"\u0316\u0300cd", true, 0, transform.ErrEndOfSpan},
|
452
|
+
// incorrectly ordered combining characters
|
453
|
+
{"ab\u0300\u0316", true, 1, transform.ErrEndOfSpan},
|
454
|
+
{"ab\u0300\u0316cd", true, 1, transform.ErrEndOfSpan},
|
455
|
+
// Hangul
|
456
|
+
{"같은", true, 6, nil},
|
457
|
+
{"같은", false, 3, transform.ErrShortSrc},
|
458
|
+
// We return the start of the violating segment in case of overflow.
|
459
|
+
{grave(30) + "\uff9e", true, 0, transform.ErrEndOfSpan},
|
460
|
+
{grave(30), true, 0, transform.ErrEndOfSpan},
|
461
|
+
}
|
462
|
+
|
463
|
+
func runSpanTests(t *testing.T, name string, f Form, testCases []spanTest) {
|
464
|
+
for i, tc := range testCases {
|
465
|
+
s := fmt.Sprintf("Bytes/%s/%d=%+q/atEOF=%v", name, i, pc(tc.input), tc.atEOF)
|
466
|
+
ok := testtext.Run(t, s, func(t *testing.T) {
|
467
|
+
n, err := f.Span([]byte(tc.input), tc.atEOF)
|
468
|
+
if n != tc.n || err != tc.err {
|
469
|
+
t.Errorf("\n got %d, %v;\nwant %d, %v", n, err, tc.n, tc.err)
|
470
|
+
}
|
471
|
+
})
|
472
|
+
if !ok {
|
473
|
+
continue // Don't do the String variant if the Bytes variant failed.
|
474
|
+
}
|
475
|
+
s = fmt.Sprintf("String/%s/%d=%+q/atEOF=%v", name, i, pc(tc.input), tc.atEOF)
|
476
|
+
testtext.Run(t, s, func(t *testing.T) {
|
477
|
+
n, err := f.SpanString(tc.input, tc.atEOF)
|
478
|
+
if n != tc.n || err != tc.err {
|
479
|
+
t.Errorf("\n got %d, %v;\nwant %d, %v", n, err, tc.n, tc.err)
|
480
|
+
}
|
481
|
+
})
|
482
|
+
}
|
483
|
+
}
|
484
|
+
|
485
|
+
func TestSpan(t *testing.T) {
|
486
|
+
runSpanTests(t, "NFD", NFD, quickSpanTests)
|
487
|
+
runSpanTests(t, "NFD", NFD, quickSpanNFDTests)
|
488
|
+
runSpanTests(t, "NFC", NFC, quickSpanTests)
|
489
|
+
runSpanTests(t, "NFC", NFC, quickSpanNFCTests)
|
490
|
+
}
|
491
|
+
|
492
|
+
var isNormalTests = []PositionTest{
|
493
|
+
{"", 1, ""},
|
494
|
+
// illegal runes
|
495
|
+
{"\xff", 1, ""},
|
496
|
+
// starters
|
497
|
+
{"a", 1, ""},
|
498
|
+
{"abc", 1, ""},
|
499
|
+
{"\u043Eb", 1, ""},
|
500
|
+
// incorrectly ordered combining characters
|
501
|
+
{"\u0300\u0316", 0, ""},
|
502
|
+
{"ab\u0300\u0316", 0, ""},
|
503
|
+
{"ab\u0300\u0316cd", 0, ""},
|
504
|
+
{"\u0300\u0316cd", 0, ""},
|
505
|
+
}
|
506
|
+
var isNormalNFDTests = []PositionTest{
|
507
|
+
// needs decomposing
|
508
|
+
{"\u00C0", 0, ""},
|
509
|
+
{"abc\u00C0", 0, ""},
|
510
|
+
// correctly ordered combining characters
|
511
|
+
{"\u0300", 1, ""},
|
512
|
+
{"ab\u0300", 1, ""},
|
513
|
+
{"ab\u0300cd", 1, ""},
|
514
|
+
{"\u0300cd", 1, ""},
|
515
|
+
{"\u0316\u0300", 1, ""},
|
516
|
+
{"ab\u0316\u0300", 1, ""},
|
517
|
+
{"ab\u0316\u0300cd", 1, ""},
|
518
|
+
{"\u0316\u0300cd", 1, ""},
|
519
|
+
{"\u043E\u0308b", 1, ""},
|
520
|
+
// Hangul
|
521
|
+
{"같은", 0, ""},
|
522
|
+
}
|
523
|
+
var isNormalNFCTests = []PositionTest{
|
524
|
+
// okay composed
|
525
|
+
{"\u00C0", 1, ""},
|
526
|
+
{"abc\u00C0", 1, ""},
|
527
|
+
// need reordering
|
528
|
+
{"a\u0300", 0, ""},
|
529
|
+
{"a\u0300cd", 0, ""},
|
530
|
+
{"a\u0316\u0300", 0, ""},
|
531
|
+
{"a\u0316\u0300cd", 0, ""},
|
532
|
+
// correctly ordered combining characters
|
533
|
+
{"ab\u0300", 1, ""},
|
534
|
+
{"ab\u0300cd", 1, ""},
|
535
|
+
{"ab\u0316\u0300", 1, ""},
|
536
|
+
{"ab\u0316\u0300cd", 1, ""},
|
537
|
+
{"\u00C0\u035D", 1, ""},
|
538
|
+
{"\u0300", 1, ""},
|
539
|
+
{"\u0316\u0300cd", 1, ""},
|
540
|
+
// Hangul
|
541
|
+
{"같은", 1, ""},
|
542
|
+
}
|
543
|
+
|
544
|
+
var isNormalNFKXTests = []PositionTest{
|
545
|
+
// Special case.
|
546
|
+
{"\u00BC", 0, ""},
|
547
|
+
}
|
548
|
+
|
549
|
+
func isNormalF(rb *reorderBuffer, s string) (int, []byte) {
|
550
|
+
if rb.f.form.IsNormal([]byte(s)) {
|
551
|
+
return 1, nil
|
552
|
+
}
|
553
|
+
return 0, nil
|
554
|
+
}
|
555
|
+
|
556
|
+
func isNormalStringF(rb *reorderBuffer, s string) (int, []byte) {
|
557
|
+
if rb.f.form.IsNormalString(s) {
|
558
|
+
return 1, nil
|
559
|
+
}
|
560
|
+
return 0, nil
|
561
|
+
}
|
562
|
+
|
563
|
+
func TestIsNormal(t *testing.T) {
|
564
|
+
runPosTests(t, "TestIsNormalNFD1", NFD, isNormalF, isNormalTests)
|
565
|
+
runPosTests(t, "TestIsNormalNFD2", NFD, isNormalF, isNormalNFDTests)
|
566
|
+
runPosTests(t, "TestIsNormalNFC1", NFC, isNormalF, isNormalTests)
|
567
|
+
runPosTests(t, "TestIsNormalNFC2", NFC, isNormalF, isNormalNFCTests)
|
568
|
+
runPosTests(t, "TestIsNormalNFKD1", NFKD, isNormalF, isNormalTests)
|
569
|
+
runPosTests(t, "TestIsNormalNFKD2", NFKD, isNormalF, isNormalNFDTests)
|
570
|
+
runPosTests(t, "TestIsNormalNFKD3", NFKD, isNormalF, isNormalNFKXTests)
|
571
|
+
runPosTests(t, "TestIsNormalNFKC1", NFKC, isNormalF, isNormalTests)
|
572
|
+
runPosTests(t, "TestIsNormalNFKC2", NFKC, isNormalF, isNormalNFCTests)
|
573
|
+
runPosTests(t, "TestIsNormalNFKC3", NFKC, isNormalF, isNormalNFKXTests)
|
574
|
+
}
|
575
|
+
|
576
|
+
func TestIsNormalString(t *testing.T) {
|
577
|
+
runPosTests(t, "TestIsNormalNFD1", NFD, isNormalStringF, isNormalTests)
|
578
|
+
runPosTests(t, "TestIsNormalNFD2", NFD, isNormalStringF, isNormalNFDTests)
|
579
|
+
runPosTests(t, "TestIsNormalNFC1", NFC, isNormalStringF, isNormalTests)
|
580
|
+
runPosTests(t, "TestIsNormalNFC2", NFC, isNormalStringF, isNormalNFCTests)
|
581
|
+
}
|
582
|
+
|
583
|
+
type AppendTest struct {
|
584
|
+
left string
|
585
|
+
right string
|
586
|
+
out string
|
587
|
+
}
|
588
|
+
|
589
|
+
type appendFunc func(f Form, out []byte, s string) []byte
|
590
|
+
|
591
|
+
var fstr = []string{"NFC", "NFD", "NFKC", "NFKD"}
|
592
|
+
|
593
|
+
func runNormTests(t *testing.T, name string, fn appendFunc) {
|
594
|
+
for f := NFC; f <= NFKD; f++ {
|
595
|
+
runAppendTests(t, name, f, fn, normTests[f])
|
596
|
+
}
|
597
|
+
}
|
598
|
+
|
599
|
+
func runAppendTests(t *testing.T, name string, f Form, fn appendFunc, tests []AppendTest) {
|
600
|
+
for i, test := range tests {
|
601
|
+
t.Run(fmt.Sprintf("%s/%d", fstr[f], i), func(t *testing.T) {
|
602
|
+
id := pc(test.left + test.right)
|
603
|
+
if *testn >= 0 && i != *testn {
|
604
|
+
return
|
605
|
+
}
|
606
|
+
t.Run("fn", func(t *testing.T) {
|
607
|
+
out := []byte(test.left)
|
608
|
+
have := string(fn(f, out, test.right))
|
609
|
+
if len(have) != len(test.out) {
|
610
|
+
t.Errorf("%+q: length is %d; want %d (%+q vs %+q)", id, len(have), len(test.out), pc(have), pc(test.out))
|
611
|
+
}
|
612
|
+
if have != test.out {
|
613
|
+
k, pf := pidx(have, test.out)
|
614
|
+
t.Errorf("%+q:\nwas %s%+q; \nwant %s%+q", id, pf, pc(have[k:]), pf, pc(test.out[k:]))
|
615
|
+
}
|
616
|
+
})
|
617
|
+
|
618
|
+
// Bootstrap by normalizing input. Ensures that the various variants
|
619
|
+
// behave the same.
|
620
|
+
for g := NFC; g <= NFKD; g++ {
|
621
|
+
if f == g {
|
622
|
+
continue
|
623
|
+
}
|
624
|
+
t.Run(fstr[g], func(t *testing.T) {
|
625
|
+
want := g.String(test.left + test.right)
|
626
|
+
have := string(fn(g, g.AppendString(nil, test.left), test.right))
|
627
|
+
if len(have) != len(want) {
|
628
|
+
t.Errorf("%+q: length is %d; want %d (%+q vs %+q)", id, len(have), len(want), pc(have), pc(want))
|
629
|
+
}
|
630
|
+
if have != want {
|
631
|
+
k, pf := pidx(have, want)
|
632
|
+
t.Errorf("%+q:\nwas %s%+q; \nwant %s%+q", id, pf, pc(have[k:]), pf, pc(want[k:]))
|
633
|
+
}
|
634
|
+
})
|
635
|
+
}
|
636
|
+
})
|
637
|
+
}
|
638
|
+
}
|
639
|
+
|
640
|
+
var normTests = [][]AppendTest{
|
641
|
+
appendTestsNFC,
|
642
|
+
appendTestsNFD,
|
643
|
+
appendTestsNFKC,
|
644
|
+
appendTestsNFKD,
|
645
|
+
}
|
646
|
+
|
647
|
+
var appendTestsNFC = []AppendTest{
|
648
|
+
{"", ascii, ascii},
|
649
|
+
{"", txt_all, txt_all},
|
650
|
+
{"\uff9e", grave(30), "\uff9e" + grave(29) + cgj + grave(1)},
|
651
|
+
{grave(30), "\uff9e", grave(30) + cgj + "\uff9e"},
|
652
|
+
|
653
|
+
// Tests designed for Iter.
|
654
|
+
{ // ordering of non-composing combining characters
|
655
|
+
"",
|
656
|
+
"\u0305\u0316",
|
657
|
+
"\u0316\u0305",
|
658
|
+
},
|
659
|
+
{ // segment overflow
|
660
|
+
"",
|
661
|
+
"a" + rep(0x0305, maxNonStarters+4) + "\u0316",
|
662
|
+
"a" + rep(0x0305, maxNonStarters) + cgj + "\u0316" + rep(0x305, 4),
|
663
|
+
},
|
664
|
+
|
665
|
+
{ // Combine across non-blocking non-starters.
|
666
|
+
// U+0327 COMBINING CEDILLA;Mn;202;NSM;;;;;N;NON-SPACING CEDILLA;;;;
|
667
|
+
// U+0325 COMBINING RING BELOW;Mn;220;NSM;;;;;N;NON-SPACING RING BELOW;;;;
|
668
|
+
"", "a\u0327\u0325", "\u1e01\u0327",
|
669
|
+
},
|
670
|
+
|
671
|
+
{ // Jamo V+T does not combine.
|
672
|
+
"",
|
673
|
+
"\u1161\u11a8",
|
674
|
+
"\u1161\u11a8",
|
675
|
+
},
|
676
|
+
|
677
|
+
// Stability tests: see http://www.unicode.org/review/pr-29.html.
|
678
|
+
{"", "\u0b47\u0300\u0b3e", "\u0b47\u0300\u0b3e"},
|
679
|
+
{"", "\u1100\u0300\u1161", "\u1100\u0300\u1161"},
|
680
|
+
{"", "\u0b47\u0b3e", "\u0b4b"},
|
681
|
+
{"", "\u1100\u1161", "\uac00"},
|
682
|
+
|
683
|
+
// U+04DA MALAYALAM VOWEL SIGN O;Mc;0;L;0D46 0D3E;;;;N;;;;;
|
684
|
+
{ // 0d4a starts a new segment.
|
685
|
+
"",
|
686
|
+
"\u0d4a" + strings.Repeat("\u0d3e", 15) + "\u0d4a" + strings.Repeat("\u0d3e", 15),
|
687
|
+
"\u0d4a" + strings.Repeat("\u0d3e", 15) + "\u0d4a" + strings.Repeat("\u0d3e", 15),
|
688
|
+
},
|
689
|
+
|
690
|
+
{ // Split combining characters.
|
691
|
+
// TODO: don't insert CGJ before starters.
|
692
|
+
"",
|
693
|
+
"\u0d46" + strings.Repeat("\u0d3e", 31),
|
694
|
+
"\u0d4a" + strings.Repeat("\u0d3e", 29) + cgj + "\u0d3e",
|
695
|
+
},
|
696
|
+
|
697
|
+
{ // Split combining characters.
|
698
|
+
"",
|
699
|
+
"\u0d4a" + strings.Repeat("\u0d3e", 30),
|
700
|
+
"\u0d4a" + strings.Repeat("\u0d3e", 29) + cgj + "\u0d3e",
|
701
|
+
},
|
702
|
+
|
703
|
+
{ // https://golang.org/issues/20079
|
704
|
+
"",
|
705
|
+
"\xeb\u0344",
|
706
|
+
"\xeb\u0308\u0301",
|
707
|
+
},
|
708
|
+
|
709
|
+
{ // https://golang.org/issues/20079
|
710
|
+
"",
|
711
|
+
"\uac00" + strings.Repeat("\u0300", 30),
|
712
|
+
"\uac00" + strings.Repeat("\u0300", 29) + "\u034f\u0300",
|
713
|
+
},
|
714
|
+
|
715
|
+
{ // https://golang.org/issues/20079
|
716
|
+
"",
|
717
|
+
"\xeb" + strings.Repeat("\u0300", 31),
|
718
|
+
"\xeb" + strings.Repeat("\u0300", 30) + "\u034f\u0300",
|
719
|
+
},
|
720
|
+
}
|
721
|
+
|
722
|
+
var appendTestsNFD = []AppendTest{
|
723
|
+
// TODO: Move some of the tests here.
|
724
|
+
}
|
725
|
+
|
726
|
+
var appendTestsNFKC = []AppendTest{
|
727
|
+
// empty buffers
|
728
|
+
{"", "", ""},
|
729
|
+
{"a", "", "a"},
|
730
|
+
{"", "a", "a"},
|
731
|
+
{"", "\u0041\u0307\u0304", "\u01E0"},
|
732
|
+
// segment split across buffers
|
733
|
+
{"", "a\u0300b", "\u00E0b"},
|
734
|
+
{"a", "\u0300b", "\u00E0b"},
|
735
|
+
{"a", "\u0300\u0316", "\u00E0\u0316"},
|
736
|
+
{"a", "\u0316\u0300", "\u00E0\u0316"},
|
737
|
+
{"a", "\u0300a\u0300", "\u00E0\u00E0"},
|
738
|
+
{"a", "\u0300a\u0300a\u0300", "\u00E0\u00E0\u00E0"},
|
739
|
+
{"a", "\u0300aaa\u0300aaa\u0300", "\u00E0aa\u00E0aa\u00E0"},
|
740
|
+
{"a\u0300", "\u0327", "\u00E0\u0327"},
|
741
|
+
{"a\u0327", "\u0300", "\u00E0\u0327"},
|
742
|
+
{"a\u0316", "\u0300", "\u00E0\u0316"},
|
743
|
+
{"\u0041\u0307", "\u0304", "\u01E0"},
|
744
|
+
// Hangul
|
745
|
+
{"", "\u110B\u1173", "\uC73C"},
|
746
|
+
{"", "\u1103\u1161", "\uB2E4"},
|
747
|
+
{"", "\u110B\u1173\u11B7", "\uC74C"},
|
748
|
+
{"", "\u320E", "\x28\uAC00\x29"},
|
749
|
+
{"", "\x28\u1100\u1161\x29", "\x28\uAC00\x29"},
|
750
|
+
{"\u1103", "\u1161", "\uB2E4"},
|
751
|
+
{"\u110B", "\u1173\u11B7", "\uC74C"},
|
752
|
+
{"\u110B\u1173", "\u11B7", "\uC74C"},
|
753
|
+
{"\uC73C", "\u11B7", "\uC74C"},
|
754
|
+
// UTF-8 encoding split across buffers
|
755
|
+
{"a\xCC", "\x80", "\u00E0"},
|
756
|
+
{"a\xCC", "\x80b", "\u00E0b"},
|
757
|
+
{"a\xCC", "\x80a\u0300", "\u00E0\u00E0"},
|
758
|
+
{"a\xCC", "\x80\x80", "\u00E0\x80"},
|
759
|
+
{"a\xCC", "\x80\xCC", "\u00E0\xCC"},
|
760
|
+
{"a\u0316\xCC", "\x80a\u0316\u0300", "\u00E0\u0316\u00E0\u0316"},
|
761
|
+
// ending in incomplete UTF-8 encoding
|
762
|
+
{"", "\xCC", "\xCC"},
|
763
|
+
{"a", "\xCC", "a\xCC"},
|
764
|
+
{"a", "b\xCC", "ab\xCC"},
|
765
|
+
{"\u0226", "\xCC", "\u0226\xCC"},
|
766
|
+
// illegal runes
|
767
|
+
{"", "\x80", "\x80"},
|
768
|
+
{"", "\x80\x80\x80", "\x80\x80\x80"},
|
769
|
+
{"", "\xCC\x80\x80\x80", "\xCC\x80\x80\x80"},
|
770
|
+
{"", "a\x80", "a\x80"},
|
771
|
+
{"", "a\x80\x80\x80", "a\x80\x80\x80"},
|
772
|
+
{"", "a\x80\x80\x80\x80\x80\x80", "a\x80\x80\x80\x80\x80\x80"},
|
773
|
+
{"a", "\x80\x80\x80", "a\x80\x80\x80"},
|
774
|
+
// overflow
|
775
|
+
{"", strings.Repeat("\x80", 33), strings.Repeat("\x80", 33)},
|
776
|
+
{strings.Repeat("\x80", 33), "", strings.Repeat("\x80", 33)},
|
777
|
+
{strings.Repeat("\x80", 33), strings.Repeat("\x80", 33), strings.Repeat("\x80", 66)},
|
778
|
+
// overflow of combining characters
|
779
|
+
{"", grave(34), grave(30) + cgj + grave(4)},
|
780
|
+
{"", grave(36), grave(30) + cgj + grave(6)},
|
781
|
+
{grave(29), grave(5), grave(30) + cgj + grave(4)},
|
782
|
+
{grave(30), grave(4), grave(30) + cgj + grave(4)},
|
783
|
+
{grave(30), grave(3), grave(30) + cgj + grave(3)},
|
784
|
+
{grave(30) + "\xCC", "\x80", grave(30) + cgj + grave(1)},
|
785
|
+
{"", "\uFDFA" + grave(14), "\u0635\u0644\u0649 \u0627\u0644\u0644\u0647 \u0639\u0644\u064a\u0647 \u0648\u0633\u0644\u0645" + grave(14)},
|
786
|
+
{"", "\uFDFA" + grave(28) + "\u0316", "\u0635\u0644\u0649 \u0627\u0644\u0644\u0647 \u0639\u0644\u064a\u0647 \u0648\u0633\u0644\u0645\u0316" + grave(28)},
|
787
|
+
// - First rune has a trailing non-starter.
|
788
|
+
{"\u00d5", grave(30), "\u00d5" + grave(29) + cgj + grave(1)},
|
789
|
+
// - U+FF9E decomposes into a non-starter in compatibility mode. A CGJ must be
|
790
|
+
// inserted even when FF9E starts a new segment.
|
791
|
+
{"\uff9e", grave(30), "\u3099" + grave(29) + cgj + grave(1)},
|
792
|
+
{grave(30), "\uff9e", grave(30) + cgj + "\u3099"},
|
793
|
+
// - Many non-starter decompositions in a row causing overflow.
|
794
|
+
{"", rep(0x340, 31), rep(0x300, 30) + cgj + "\u0300"},
|
795
|
+
{"", rep(0xFF9E, 31), rep(0x3099, 30) + cgj + "\u3099"},
|
796
|
+
|
797
|
+
{"", "\u0644\u0625" + rep(0x300, 31), "\u0644\u0625" + rep(0x300, 29) + cgj + "\u0300\u0300"},
|
798
|
+
{"", "\ufef9" + rep(0x300, 31), "\u0644\u0625" + rep(0x300, 29) + cgj + rep(0x0300, 2)},
|
799
|
+
{"", "\ufef9" + rep(0x300, 31), "\u0644\u0625" + rep(0x300, 29) + cgj + rep(0x0300, 2)},
|
800
|
+
|
801
|
+
// U+0F81 TIBETAN VOWEL SIGN REVERSED II splits into two modifiers.
|
802
|
+
{"", "\u0f7f" + rep(0xf71, 29) + "\u0f81", "\u0f7f" + rep(0xf71, 29) + cgj + "\u0f71\u0f80"},
|
803
|
+
{"", "\u0f7f" + rep(0xf71, 28) + "\u0f81", "\u0f7f" + rep(0xf71, 29) + "\u0f80"},
|
804
|
+
{"", "\u0f7f" + rep(0xf81, 16), "\u0f7f" + rep(0xf71, 15) + rep(0xf80, 15) + cgj + "\u0f71\u0f80"},
|
805
|
+
|
806
|
+
// weird UTF-8
|
807
|
+
{"\u00E0\xE1", "\x86", "\u00E0\xE1\x86"},
|
808
|
+
{"a\u0300\u11B7", "\u0300", "\u00E0\u11B7\u0300"},
|
809
|
+
{"a\u0300\u11B7\u0300", "\u0300", "\u00E0\u11B7\u0300\u0300"},
|
810
|
+
{"\u0300", "\xF8\x80\x80\x80\x80\u0300", "\u0300\xF8\x80\x80\x80\x80\u0300"},
|
811
|
+
{"\u0300", "\xFC\x80\x80\x80\x80\x80\u0300", "\u0300\xFC\x80\x80\x80\x80\x80\u0300"},
|
812
|
+
{"\xF8\x80\x80\x80\x80\u0300", "\u0300", "\xF8\x80\x80\x80\x80\u0300\u0300"},
|
813
|
+
{"\xFC\x80\x80\x80\x80\x80\u0300", "\u0300", "\xFC\x80\x80\x80\x80\x80\u0300\u0300"},
|
814
|
+
{"\xF8\x80\x80\x80", "\x80\u0300\u0300", "\xF8\x80\x80\x80\x80\u0300\u0300"},
|
815
|
+
|
816
|
+
{"", strings.Repeat("a\u0316\u0300", 6), strings.Repeat("\u00E0\u0316", 6)},
|
817
|
+
// large input.
|
818
|
+
{"", strings.Repeat("a\u0300\u0316", 31), strings.Repeat("\u00E0\u0316", 31)},
|
819
|
+
{"", strings.Repeat("a\u0300\u0316", 4000), strings.Repeat("\u00E0\u0316", 4000)},
|
820
|
+
{"", strings.Repeat("\x80\x80", 4000), strings.Repeat("\x80\x80", 4000)},
|
821
|
+
{"", "\u0041\u0307\u0304", "\u01E0"},
|
822
|
+
}
|
823
|
+
|
824
|
+
var appendTestsNFKD = []AppendTest{
|
825
|
+
{"", "a" + grave(64), "a" + grave(30) + cgj + grave(30) + cgj + grave(4)},
|
826
|
+
|
827
|
+
{ // segment overflow on unchanged character
|
828
|
+
"",
|
829
|
+
"a" + grave(64) + "\u0316",
|
830
|
+
"a" + grave(30) + cgj + grave(30) + cgj + "\u0316" + grave(4),
|
831
|
+
},
|
832
|
+
{ // segment overflow on unchanged character + start value
|
833
|
+
"",
|
834
|
+
"a" + grave(98) + "\u0316",
|
835
|
+
"a" + grave(30) + cgj + grave(30) + cgj + grave(30) + cgj + "\u0316" + grave(8),
|
836
|
+
},
|
837
|
+
{ // segment overflow on decomposition. (U+0340 decomposes to U+0300.)
|
838
|
+
"",
|
839
|
+
"a" + grave(59) + "\u0340",
|
840
|
+
"a" + grave(30) + cgj + grave(30),
|
841
|
+
},
|
842
|
+
{ // segment overflow on non-starter decomposition
|
843
|
+
"",
|
844
|
+
"a" + grave(33) + "\u0340" + grave(30) + "\u0320",
|
845
|
+
"a" + grave(30) + cgj + grave(30) + cgj + "\u0320" + grave(4),
|
846
|
+
},
|
847
|
+
{ // start value after ASCII overflow
|
848
|
+
"",
|
849
|
+
rep('a', segSize) + grave(32) + "\u0320",
|
850
|
+
rep('a', segSize) + grave(30) + cgj + "\u0320" + grave(2),
|
851
|
+
},
|
852
|
+
{ // Jamo overflow
|
853
|
+
"",
|
854
|
+
"\u1100\u1161" + grave(30) + "\u0320" + grave(2),
|
855
|
+
"\u1100\u1161" + grave(29) + cgj + "\u0320" + grave(3),
|
856
|
+
},
|
857
|
+
{ // Hangul
|
858
|
+
"",
|
859
|
+
"\uac00",
|
860
|
+
"\u1100\u1161",
|
861
|
+
},
|
862
|
+
{ // Hangul overflow
|
863
|
+
"",
|
864
|
+
"\uac00" + grave(32) + "\u0320",
|
865
|
+
"\u1100\u1161" + grave(29) + cgj + "\u0320" + grave(3),
|
866
|
+
},
|
867
|
+
{ // Hangul overflow in Hangul mode.
|
868
|
+
"",
|
869
|
+
"\uac00\uac00" + grave(32) + "\u0320",
|
870
|
+
"\u1100\u1161\u1100\u1161" + grave(29) + cgj + "\u0320" + grave(3),
|
871
|
+
},
|
872
|
+
{ // Hangul overflow in Hangul mode.
|
873
|
+
"",
|
874
|
+
strings.Repeat("\uac00", 3) + grave(32) + "\u0320",
|
875
|
+
strings.Repeat("\u1100\u1161", 3) + grave(29) + cgj + "\u0320" + grave(3),
|
876
|
+
},
|
877
|
+
{ // start value after cc=0
|
878
|
+
"",
|
879
|
+
"您您" + grave(34) + "\u0320",
|
880
|
+
"您您" + grave(30) + cgj + "\u0320" + grave(4),
|
881
|
+
},
|
882
|
+
{ // start value after normalization
|
883
|
+
"",
|
884
|
+
"\u0300\u0320a" + grave(34) + "\u0320",
|
885
|
+
"\u0320\u0300a" + grave(30) + cgj + "\u0320" + grave(4),
|
886
|
+
},
|
887
|
+
{
|
888
|
+
// U+0F81 TIBETAN VOWEL SIGN REVERSED II splits into two modifiers.
|
889
|
+
"",
|
890
|
+
"a\u0f7f" + rep(0xf71, 29) + "\u0f81",
|
891
|
+
"a\u0f7f" + rep(0xf71, 29) + cgj + "\u0f71\u0f80",
|
892
|
+
},
|
893
|
+
}
|
894
|
+
|
895
|
+
func TestAppend(t *testing.T) {
|
896
|
+
runNormTests(t, "Append", func(f Form, out []byte, s string) []byte {
|
897
|
+
return f.Append(out, []byte(s)...)
|
898
|
+
})
|
899
|
+
}
|
900
|
+
|
901
|
+
func TestAppendString(t *testing.T) {
|
902
|
+
runNormTests(t, "AppendString", func(f Form, out []byte, s string) []byte {
|
903
|
+
return f.AppendString(out, s)
|
904
|
+
})
|
905
|
+
}
|
906
|
+
|
907
|
+
func TestBytes(t *testing.T) {
|
908
|
+
runNormTests(t, "Bytes", func(f Form, out []byte, s string) []byte {
|
909
|
+
buf := []byte{}
|
910
|
+
buf = append(buf, out...)
|
911
|
+
buf = append(buf, s...)
|
912
|
+
return f.Bytes(buf)
|
913
|
+
})
|
914
|
+
}
|
915
|
+
|
916
|
+
func TestString(t *testing.T) {
|
917
|
+
runNormTests(t, "String", func(f Form, out []byte, s string) []byte {
|
918
|
+
outs := string(out) + s
|
919
|
+
return []byte(f.String(outs))
|
920
|
+
})
|
921
|
+
}
|
922
|
+
|
923
|
+
func TestLinking(t *testing.T) {
|
924
|
+
const prog = `
|
925
|
+
package main
|
926
|
+
import "fmt"
|
927
|
+
import "golang.org/x/text/unicode/norm"
|
928
|
+
func main() { fmt.Println(norm.%s) }
|
929
|
+
`
|
930
|
+
baseline, errB := testtext.CodeSize(fmt.Sprintf(prog, "MaxSegmentSize"))
|
931
|
+
withTables, errT := testtext.CodeSize(fmt.Sprintf(prog, `NFC.String("")`))
|
932
|
+
if errB != nil || errT != nil {
|
933
|
+
t.Skipf("code size failed: %v and %v", errB, errT)
|
934
|
+
}
|
935
|
+
// Tables are at least 50K
|
936
|
+
if d := withTables - baseline; d < 50*1024 {
|
937
|
+
t.Errorf("tables appear not to be dropped: %d - %d = %d",
|
938
|
+
withTables, baseline, d)
|
939
|
+
}
|
940
|
+
}
|
941
|
+
|
942
|
+
func appendBench(f Form, in []byte) func() {
|
943
|
+
buf := make([]byte, 0, 4*len(in))
|
944
|
+
return func() {
|
945
|
+
f.Append(buf, in...)
|
946
|
+
}
|
947
|
+
}
|
948
|
+
|
949
|
+
func bytesBench(f Form, in []byte) func() {
|
950
|
+
return func() {
|
951
|
+
f.Bytes(in)
|
952
|
+
}
|
953
|
+
}
|
954
|
+
|
955
|
+
func iterBench(f Form, in []byte) func() {
|
956
|
+
iter := Iter{}
|
957
|
+
return func() {
|
958
|
+
iter.Init(f, in)
|
959
|
+
for !iter.Done() {
|
960
|
+
iter.Next()
|
961
|
+
}
|
962
|
+
}
|
963
|
+
}
|
964
|
+
|
965
|
+
func transformBench(f Form, in []byte) func() {
|
966
|
+
buf := make([]byte, 4*len(in))
|
967
|
+
return func() {
|
968
|
+
if _, n, err := f.Transform(buf, in, true); err != nil || len(in) != n {
|
969
|
+
log.Panic(n, len(in), err)
|
970
|
+
}
|
971
|
+
}
|
972
|
+
}
|
973
|
+
|
974
|
+
func readerBench(f Form, in []byte) func() {
|
975
|
+
buf := make([]byte, 4*len(in))
|
976
|
+
return func() {
|
977
|
+
r := f.Reader(bytes.NewReader(in))
|
978
|
+
var err error
|
979
|
+
for err == nil {
|
980
|
+
_, err = r.Read(buf)
|
981
|
+
}
|
982
|
+
if err != io.EOF {
|
983
|
+
panic("")
|
984
|
+
}
|
985
|
+
}
|
986
|
+
}
|
987
|
+
|
988
|
+
func writerBench(f Form, in []byte) func() {
|
989
|
+
buf := make([]byte, 0, 4*len(in))
|
990
|
+
return func() {
|
991
|
+
r := f.Writer(bytes.NewBuffer(buf))
|
992
|
+
if _, err := r.Write(in); err != nil {
|
993
|
+
panic("")
|
994
|
+
}
|
995
|
+
}
|
996
|
+
}
|
997
|
+
|
998
|
+
func appendBenchmarks(bm []func(), f Form, in []byte) []func() {
|
999
|
+
bm = append(bm, appendBench(f, in))
|
1000
|
+
bm = append(bm, iterBench(f, in))
|
1001
|
+
bm = append(bm, transformBench(f, in))
|
1002
|
+
bm = append(bm, readerBench(f, in))
|
1003
|
+
bm = append(bm, writerBench(f, in))
|
1004
|
+
return bm
|
1005
|
+
}
|
1006
|
+
|
1007
|
+
func doFormBenchmark(b *testing.B, inf, f Form, s string) {
|
1008
|
+
b.StopTimer()
|
1009
|
+
in := inf.Bytes([]byte(s))
|
1010
|
+
bm := appendBenchmarks(nil, f, in)
|
1011
|
+
b.SetBytes(int64(len(in) * len(bm)))
|
1012
|
+
b.StartTimer()
|
1013
|
+
for i := 0; i < b.N; i++ {
|
1014
|
+
for _, fn := range bm {
|
1015
|
+
fn()
|
1016
|
+
}
|
1017
|
+
}
|
1018
|
+
}
|
1019
|
+
|
1020
|
+
func doSingle(b *testing.B, f func(Form, []byte) func(), s []byte) {
|
1021
|
+
b.StopTimer()
|
1022
|
+
fn := f(NFC, s)
|
1023
|
+
b.SetBytes(int64(len(s)))
|
1024
|
+
b.StartTimer()
|
1025
|
+
for i := 0; i < b.N; i++ {
|
1026
|
+
fn()
|
1027
|
+
}
|
1028
|
+
}
|
1029
|
+
|
1030
|
+
var (
|
1031
|
+
smallNoChange = []byte("nörmalization")
|
1032
|
+
smallChange = []byte("No\u0308rmalization")
|
1033
|
+
ascii = strings.Repeat("There is nothing to change here! ", 500)
|
1034
|
+
)
|
1035
|
+
|
1036
|
+
func lowerBench(f Form, in []byte) func() {
|
1037
|
+
// Use package strings instead of bytes as it doesn't allocate memory
|
1038
|
+
// if there aren't any changes.
|
1039
|
+
s := string(in)
|
1040
|
+
return func() {
|
1041
|
+
strings.ToLower(s)
|
1042
|
+
}
|
1043
|
+
}
|
1044
|
+
|
1045
|
+
func BenchmarkLowerCaseNoChange(b *testing.B) {
|
1046
|
+
doSingle(b, lowerBench, smallNoChange)
|
1047
|
+
}
|
1048
|
+
func BenchmarkLowerCaseChange(b *testing.B) {
|
1049
|
+
doSingle(b, lowerBench, smallChange)
|
1050
|
+
}
|
1051
|
+
|
1052
|
+
func quickSpanBench(f Form, in []byte) func() {
|
1053
|
+
return func() {
|
1054
|
+
f.QuickSpan(in)
|
1055
|
+
}
|
1056
|
+
}
|
1057
|
+
|
1058
|
+
func BenchmarkQuickSpanChangeNFC(b *testing.B) {
|
1059
|
+
doSingle(b, quickSpanBench, smallNoChange)
|
1060
|
+
}
|
1061
|
+
|
1062
|
+
func BenchmarkBytesNoChangeNFC(b *testing.B) {
|
1063
|
+
doSingle(b, bytesBench, smallNoChange)
|
1064
|
+
}
|
1065
|
+
func BenchmarkBytesChangeNFC(b *testing.B) {
|
1066
|
+
doSingle(b, bytesBench, smallChange)
|
1067
|
+
}
|
1068
|
+
|
1069
|
+
func BenchmarkAppendNoChangeNFC(b *testing.B) {
|
1070
|
+
doSingle(b, appendBench, smallNoChange)
|
1071
|
+
}
|
1072
|
+
func BenchmarkAppendChangeNFC(b *testing.B) {
|
1073
|
+
doSingle(b, appendBench, smallChange)
|
1074
|
+
}
|
1075
|
+
func BenchmarkAppendLargeNFC(b *testing.B) {
|
1076
|
+
doSingle(b, appendBench, txt_all_bytes)
|
1077
|
+
}
|
1078
|
+
|
1079
|
+
func BenchmarkIterNoChangeNFC(b *testing.B) {
|
1080
|
+
doSingle(b, iterBench, smallNoChange)
|
1081
|
+
}
|
1082
|
+
func BenchmarkIterChangeNFC(b *testing.B) {
|
1083
|
+
doSingle(b, iterBench, smallChange)
|
1084
|
+
}
|
1085
|
+
func BenchmarkIterLargeNFC(b *testing.B) {
|
1086
|
+
doSingle(b, iterBench, txt_all_bytes)
|
1087
|
+
}
|
1088
|
+
|
1089
|
+
func BenchmarkTransformNoChangeNFC(b *testing.B) {
|
1090
|
+
doSingle(b, transformBench, smallNoChange)
|
1091
|
+
}
|
1092
|
+
func BenchmarkTransformChangeNFC(b *testing.B) {
|
1093
|
+
doSingle(b, transformBench, smallChange)
|
1094
|
+
}
|
1095
|
+
func BenchmarkTransformLargeNFC(b *testing.B) {
|
1096
|
+
doSingle(b, transformBench, txt_all_bytes)
|
1097
|
+
}
|
1098
|
+
|
1099
|
+
func BenchmarkNormalizeAsciiNFC(b *testing.B) {
|
1100
|
+
doFormBenchmark(b, NFC, NFC, ascii)
|
1101
|
+
}
|
1102
|
+
func BenchmarkNormalizeAsciiNFD(b *testing.B) {
|
1103
|
+
doFormBenchmark(b, NFC, NFD, ascii)
|
1104
|
+
}
|
1105
|
+
func BenchmarkNormalizeAsciiNFKC(b *testing.B) {
|
1106
|
+
doFormBenchmark(b, NFC, NFKC, ascii)
|
1107
|
+
}
|
1108
|
+
func BenchmarkNormalizeAsciiNFKD(b *testing.B) {
|
1109
|
+
doFormBenchmark(b, NFC, NFKD, ascii)
|
1110
|
+
}
|
1111
|
+
|
1112
|
+
func BenchmarkNormalizeNFC2NFC(b *testing.B) {
|
1113
|
+
doFormBenchmark(b, NFC, NFC, txt_all)
|
1114
|
+
}
|
1115
|
+
func BenchmarkNormalizeNFC2NFD(b *testing.B) {
|
1116
|
+
doFormBenchmark(b, NFC, NFD, txt_all)
|
1117
|
+
}
|
1118
|
+
func BenchmarkNormalizeNFD2NFC(b *testing.B) {
|
1119
|
+
doFormBenchmark(b, NFD, NFC, txt_all)
|
1120
|
+
}
|
1121
|
+
func BenchmarkNormalizeNFD2NFD(b *testing.B) {
|
1122
|
+
doFormBenchmark(b, NFD, NFD, txt_all)
|
1123
|
+
}
|
1124
|
+
|
1125
|
+
// Hangul is often special-cased, so we test it separately.
|
1126
|
+
func BenchmarkNormalizeHangulNFC2NFC(b *testing.B) {
|
1127
|
+
doFormBenchmark(b, NFC, NFC, txt_kr)
|
1128
|
+
}
|
1129
|
+
func BenchmarkNormalizeHangulNFC2NFD(b *testing.B) {
|
1130
|
+
doFormBenchmark(b, NFC, NFD, txt_kr)
|
1131
|
+
}
|
1132
|
+
func BenchmarkNormalizeHangulNFD2NFC(b *testing.B) {
|
1133
|
+
doFormBenchmark(b, NFD, NFC, txt_kr)
|
1134
|
+
}
|
1135
|
+
func BenchmarkNormalizeHangulNFD2NFD(b *testing.B) {
|
1136
|
+
doFormBenchmark(b, NFD, NFD, txt_kr)
|
1137
|
+
}
|
1138
|
+
|
1139
|
+
var forms = []Form{NFC, NFD, NFKC, NFKD}
|
1140
|
+
|
1141
|
+
func doTextBenchmark(b *testing.B, s string) {
|
1142
|
+
b.StopTimer()
|
1143
|
+
in := []byte(s)
|
1144
|
+
bm := []func(){}
|
1145
|
+
for _, f := range forms {
|
1146
|
+
bm = appendBenchmarks(bm, f, in)
|
1147
|
+
}
|
1148
|
+
b.SetBytes(int64(len(s) * len(bm)))
|
1149
|
+
b.StartTimer()
|
1150
|
+
for i := 0; i < b.N; i++ {
|
1151
|
+
for _, f := range bm {
|
1152
|
+
f()
|
1153
|
+
}
|
1154
|
+
}
|
1155
|
+
}
|
1156
|
+
|
1157
|
+
func BenchmarkCanonicalOrdering(b *testing.B) {
|
1158
|
+
doTextBenchmark(b, txt_canon)
|
1159
|
+
}
|
1160
|
+
func BenchmarkExtendedLatin(b *testing.B) {
|
1161
|
+
doTextBenchmark(b, txt_vn)
|
1162
|
+
}
|
1163
|
+
func BenchmarkMiscTwoByteUtf8(b *testing.B) {
|
1164
|
+
doTextBenchmark(b, twoByteUtf8)
|
1165
|
+
}
|
1166
|
+
func BenchmarkMiscThreeByteUtf8(b *testing.B) {
|
1167
|
+
doTextBenchmark(b, threeByteUtf8)
|
1168
|
+
}
|
1169
|
+
func BenchmarkHangul(b *testing.B) {
|
1170
|
+
doTextBenchmark(b, txt_kr)
|
1171
|
+
}
|
1172
|
+
func BenchmarkJapanese(b *testing.B) {
|
1173
|
+
doTextBenchmark(b, txt_jp)
|
1174
|
+
}
|
1175
|
+
func BenchmarkChinese(b *testing.B) {
|
1176
|
+
doTextBenchmark(b, txt_cn)
|
1177
|
+
}
|
1178
|
+
func BenchmarkOverflow(b *testing.B) {
|
1179
|
+
doTextBenchmark(b, overflow)
|
1180
|
+
}
|
1181
|
+
|
1182
|
+
var overflow = string(bytes.Repeat([]byte("\u035D"), 4096)) + "\u035B"
|
1183
|
+
|
1184
|
+
// Tests sampled from the Canonical ordering tests (Part 2) of
|
1185
|
+
// http://unicode.org/Public/UNIDATA/NormalizationTest.txt
|
1186
|
+
const txt_canon = `\u0061\u0315\u0300\u05AE\u0300\u0062 \u0061\u0300\u0315\u0300\u05AE\u0062
|
1187
|
+
\u0061\u0302\u0315\u0300\u05AE\u0062 \u0061\u0307\u0315\u0300\u05AE\u0062
|
1188
|
+
\u0061\u0315\u0300\u05AE\u030A\u0062 \u0061\u059A\u0316\u302A\u031C\u0062
|
1189
|
+
\u0061\u032E\u059A\u0316\u302A\u0062 \u0061\u0338\u093C\u0334\u0062
|
1190
|
+
\u0061\u059A\u0316\u302A\u0339 \u0061\u0341\u0315\u0300\u05AE\u0062
|
1191
|
+
\u0061\u0348\u059A\u0316\u302A\u0062 \u0061\u0361\u0345\u035D\u035C\u0062
|
1192
|
+
\u0061\u0366\u0315\u0300\u05AE\u0062 \u0061\u0315\u0300\u05AE\u0486\u0062
|
1193
|
+
\u0061\u05A4\u059A\u0316\u302A\u0062 \u0061\u0315\u0300\u05AE\u0613\u0062
|
1194
|
+
\u0061\u0315\u0300\u05AE\u0615\u0062 \u0061\u0617\u0315\u0300\u05AE\u0062
|
1195
|
+
\u0061\u0619\u0618\u064D\u064E\u0062 \u0061\u0315\u0300\u05AE\u0654\u0062
|
1196
|
+
\u0061\u0315\u0300\u05AE\u06DC\u0062 \u0061\u0733\u0315\u0300\u05AE\u0062
|
1197
|
+
\u0061\u0744\u059A\u0316\u302A\u0062 \u0061\u0315\u0300\u05AE\u0745\u0062
|
1198
|
+
\u0061\u09CD\u05B0\u094D\u3099\u0062 \u0061\u0E38\u0E48\u0E38\u0C56\u0062
|
1199
|
+
\u0061\u0EB8\u0E48\u0E38\u0E49\u0062 \u0061\u0F72\u0F71\u0EC8\u0F71\u0062
|
1200
|
+
\u0061\u1039\u05B0\u094D\u3099\u0062 \u0061\u05B0\u094D\u3099\u1A60\u0062
|
1201
|
+
\u0061\u3099\u093C\u0334\u1BE6\u0062 \u0061\u3099\u093C\u0334\u1C37\u0062
|
1202
|
+
\u0061\u1CD9\u059A\u0316\u302A\u0062 \u0061\u2DED\u0315\u0300\u05AE\u0062
|
1203
|
+
\u0061\u2DEF\u0315\u0300\u05AE\u0062 \u0061\u302D\u302E\u059A\u0316\u0062`
|
1204
|
+
|
1205
|
+
// Taken from http://creativecommons.org/licenses/by-sa/3.0/vn/
|
1206
|
+
const txt_vn = `Với các điều kiện sau: Ghi nhận công của tác giả.
|
1207
|
+
Nếu bạn sử dụng, chuyển đổi, hoặc xây dựng dự án từ
|
1208
|
+
nội dung được chia sẻ này, bạn phải áp dụng giấy phép này hoặc
|
1209
|
+
một giấy phép khác có các điều khoản tương tự như giấy phép này
|
1210
|
+
cho dự án của bạn. Hiểu rằng: Miễn — Bất kỳ các điều kiện nào
|
1211
|
+
trên đây cũng có thể được miễn bỏ nếu bạn được sự cho phép của
|
1212
|
+
người sở hữu bản quyền. Phạm vi công chúng — Khi tác phẩm hoặc
|
1213
|
+
bất kỳ chương nào của tác phẩm đã trong vùng dành cho công
|
1214
|
+
chúng theo quy định của pháp luật thì tình trạng của nó không
|
1215
|
+
bị ảnh hưởng bởi giấy phép trong bất kỳ trường hợp nào.`
|
1216
|
+
|
1217
|
+
// Taken from http://creativecommons.org/licenses/by-sa/1.0/deed.ru
|
1218
|
+
const txt_ru = `При обязательном соблюдении следующих условий:
|
1219
|
+
Attribution — Вы должны атрибутировать произведение (указывать
|
1220
|
+
автора и источник) в порядке, предусмотренном автором или
|
1221
|
+
лицензиаром (но только так, чтобы никоим образом не подразумевалось,
|
1222
|
+
что они поддерживают вас или использование вами данного произведения).
|
1223
|
+
Υπό τις ακόλουθες προϋποθέσεις:`
|
1224
|
+
|
1225
|
+
// Taken from http://creativecommons.org/licenses/by-sa/3.0/gr/
|
1226
|
+
const txt_gr = `Αναφορά Δημιουργού — Θα πρέπει να κάνετε την αναφορά στο έργο με τον
|
1227
|
+
τρόπο που έχει οριστεί από το δημιουργό ή το χορηγούντο την άδεια
|
1228
|
+
(χωρίς όμως να εννοείται με οποιονδήποτε τρόπο ότι εγκρίνουν εσάς ή
|
1229
|
+
τη χρήση του έργου από εσάς). Παρόμοια Διανομή — Εάν αλλοιώσετε,
|
1230
|
+
τροποποιήσετε ή δημιουργήσετε περαιτέρω βασισμένοι στο έργο θα
|
1231
|
+
μπορείτε να διανέμετε το έργο που θα προκύψει μόνο με την ίδια ή
|
1232
|
+
παρόμοια άδεια.`
|
1233
|
+
|
1234
|
+
// Taken from http://creativecommons.org/licenses/by-sa/3.0/deed.ar
|
1235
|
+
const txt_ar = `بموجب الشروط التالية نسب المصنف — يجب عليك أن
|
1236
|
+
تنسب العمل بالطريقة التي تحددها المؤلف أو المرخص (ولكن ليس بأي حال من
|
1237
|
+
الأحوال أن توحي وتقترح بتحول أو استخدامك للعمل).
|
1238
|
+
المشاركة على قدم المساواة — إذا كنت يعدل ، والتغيير ، أو الاستفادة
|
1239
|
+
من هذا العمل ، قد ينتج عن توزيع العمل إلا في ظل تشابه او تطابق فى واحد
|
1240
|
+
لهذا الترخيص.`
|
1241
|
+
|
1242
|
+
// Taken from http://creativecommons.org/licenses/by-sa/1.0/il/
|
1243
|
+
const txt_il = `בכפוף לתנאים הבאים: ייחוס — עליך לייחס את היצירה (לתת קרדיט) באופן
|
1244
|
+
המצויין על-ידי היוצר או מעניק הרישיון (אך לא בשום אופן המרמז על כך
|
1245
|
+
שהם תומכים בך או בשימוש שלך ביצירה). שיתוף זהה — אם תחליט/י לשנות,
|
1246
|
+
לעבד או ליצור יצירה נגזרת בהסתמך על יצירה זו, תוכל/י להפיץ את יצירתך
|
1247
|
+
החדשה רק תחת אותו הרישיון או רישיון דומה לרישיון זה.`
|
1248
|
+
|
1249
|
+
const twoByteUtf8 = txt_ru + txt_gr + txt_ar + txt_il
|
1250
|
+
|
1251
|
+
// Taken from http://creativecommons.org/licenses/by-sa/2.0/kr/
|
1252
|
+
const txt_kr = `다음과 같은 조건을 따라야 합니다: 저작자표시
|
1253
|
+
(Attribution) — 저작자나 이용허락자가 정한 방법으로 저작물의
|
1254
|
+
원저작자를 표시하여야 합니다(그러나 원저작자가 이용자나 이용자의
|
1255
|
+
이용을 보증하거나 추천한다는 의미로 표시해서는 안됩니다).
|
1256
|
+
동일조건변경허락 — 이 저작물을 이용하여 만든 이차적 저작물에는 본
|
1257
|
+
라이선스와 동일한 라이선스를 적용해야 합니다.`
|
1258
|
+
|
1259
|
+
// Taken from http://creativecommons.org/licenses/by-sa/3.0/th/
|
1260
|
+
const txt_th = `ภายใต้เงื่อนไข ดังต่อไปนี้ : แสดงที่มา — คุณต้องแสดงที่
|
1261
|
+
มาของงานดังกล่าว ตามรูปแบบที่ผู้สร้างสรรค์หรือผู้อนุญาตกำหนด (แต่
|
1262
|
+
ไม่ใช่ในลักษณะที่ว่า พวกเขาสนับสนุนคุณหรือสนับสนุนการที่
|
1263
|
+
คุณนำงานไปใช้) อนุญาตแบบเดียวกัน — หากคุณดัดแปลง เปลี่ยนรูป หรื
|
1264
|
+
อต่อเติมงานนี้ คุณต้องใช้สัญญาอนุญาตแบบเดียวกันหรือแบบที่เหมื
|
1265
|
+
อนกับสัญญาอนุญาตที่ใช้กับงานนี้เท่านั้น`
|
1266
|
+
|
1267
|
+
const threeByteUtf8 = txt_th
|
1268
|
+
|
1269
|
+
// Taken from http://creativecommons.org/licenses/by-sa/2.0/jp/
|
1270
|
+
const txt_jp = `あなたの従うべき条件は以下の通りです。
|
1271
|
+
表示 — あなたは原著作者のクレジットを表示しなければなりません。
|
1272
|
+
継承 — もしあなたがこの作品を改変、変形または加工した場合、
|
1273
|
+
あなたはその結果生じた作品をこの作品と同一の許諾条件の下でのみ
|
1274
|
+
頒布することができます。`
|
1275
|
+
|
1276
|
+
// http://creativecommons.org/licenses/by-sa/2.5/cn/
|
1277
|
+
const txt_cn = `您可以自由: 复制、发行、展览、表演、放映、
|
1278
|
+
广播或通过信息网络传播本作品 创作演绎作品
|
1279
|
+
对本作品进行商业性使用 惟须遵守下列条件:
|
1280
|
+
署名 — 您必须按照作者或者许可人指定的方式对作品进行署名。
|
1281
|
+
相同方式共享 — 如果您改变、转换本作品或者以本作品为基础进行创作,
|
1282
|
+
您只能采用与本协议相同的许可协议发布基于本作品的演绎作品。`
|
1283
|
+
|
1284
|
+
const txt_cjk = txt_cn + txt_jp + txt_kr
|
1285
|
+
const txt_all = txt_vn + twoByteUtf8 + threeByteUtf8 + txt_cjk
|
1286
|
+
|
1287
|
+
var txt_all_bytes = []byte(txt_all)
|