Debian Codegraph @

serve_mux_test.go

raw symbols SCIP
1 package dnsscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/
2
3 import "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/"
4
5 func TestDotAsCatchAllWildcardscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/TestDotAsCatchAllWildcard().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
6 mux := NewServeMuxscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/NewServeMux().()
7 mux.Handlescip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/ServeMux#Handle().(".", HandlerFuncscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/HandlerFunc#(HelloServerscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/HelloServer().))
8 mux.Handlescip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/ServeMux#Handle().("example.com.", HandlerFuncscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/HandlerFunc#(AnotherHelloServerscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/AnotherHelloServer().))
9
10 handler := mux.matchscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/ServeMux#match().("www.miek.nl.", TypeTXTscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/TypeTXT.)
11 if handler == nil {
12 t.Errorscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Error().("wildcard match failed")
13 }
14
15 handler = mux.matchscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/ServeMux#match().("www.example.com.", TypeTXTscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/TypeTXT.)
16 if handler == nil {
17 t.Errorscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Error().("example.com match failed")
18 }
19
20 handler = mux.matchscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/ServeMux#match().("a.www.example.com.", TypeTXTscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/TypeTXT.)
21 if handler == nil {
22 t.Errorscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Error().("a.www.example.com match failed")
23 }
24
25 handler = mux.matchscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/ServeMux#match().("boe.", TypeTXTscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/TypeTXT.)
26 if handler == nil {
27 t.Errorscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Error().("boe. match failed")
28 }
29 }
30
31 func TestCaseFoldingscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/TestCaseFolding().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
32 mux := NewServeMuxscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/NewServeMux().()
33 mux.Handlescip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/ServeMux#Handle().("_udp.example.com.", HandlerFuncscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/HandlerFunc#(HelloServerscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/HelloServer().))
34
35 handler := mux.matchscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/ServeMux#match().("_dns._udp.example.com.", TypeSRVscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/TypeSRV.)
36 if handler == nil {
37 t.Errorscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Error().("case sensitive characters folded")
38 }
39
40 handler = mux.matchscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/ServeMux#match().("_DNS._UDP.EXAMPLE.COM.", TypeSRVscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/TypeSRV.)
41 if handler == nil {
42 t.Errorscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Error().("case insensitive characters not folded")
43 }
44 }
45
46 func TestRootServerscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/TestRootServer().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) {
47 mux := NewServeMuxscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/NewServeMux().()
48 mux.Handlescip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/ServeMux#Handle().(".", HandlerFuncscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/HandlerFunc#(HelloServerscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/HelloServer().))
49
50 handler := mux.matchscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/ServeMux#match().(".", TypeNSscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/TypeNS.)
51 if handler == nil {
52 t.Errorscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Error().("root match failed")
53 }
54 }
55
56 func BenchmarkMuxMatchscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/BenchmarkMuxMatch().(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
57 mux := NewServeMuxscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/NewServeMux().()
58 mux.Handlescip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/ServeMux#Handle().("_udp.example.com.", HandlerFuncscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/HandlerFunc#(HelloServerscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/HelloServer().))
59
60 bench := func(q string) func(*testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
61 return func(b *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Bscip-go gomod github.com/golang/go/src go1.25.0 testing/B#) {
62 for n := 0; n < b.Nscip-go gomod github.com/golang/go/src go1.25.0 testing/B#N.; n++ {
63 handler := mux.matchscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/ServeMux#match().(q, TypeSRVscip-go gomod github.com/miekg/dns . `github.com/miekg/dns`/TypeSRV.)
64 if handler == nil {
65 b.Fatalscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatal().("couldn't find match")
66 }
67 }
68 }
69 }
70 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("lowercase", bench("_dns._udp.example.com."))
71 b.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/B#Run().("uppercase", bench("_DNS._UDP.EXAMPLE.COM."))
72 }