aboutsummaryrefslogtreecommitdiff
path: root/request/request_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'request/request_test.go')
-rw-r--r--request/request_test.go29
1 files changed, 29 insertions, 0 deletions
diff --git a/request/request_test.go b/request/request_test.go
index 563e6dfe2..bc08ea6ab 100644
--- a/request/request_test.go
+++ b/request/request_test.go
@@ -31,6 +31,35 @@ func TestRequestRemote(t *testing.T) {
}
}
+func TestRequestMalformed(t *testing.T) {
+ m := new(dns.Msg)
+ st := Request{Req: m}
+
+ if x := st.QType(); x != 0 {
+ t.Errorf("Expected 0 Qtype, got %d", x)
+ }
+
+ if x := st.QClass(); x != 0 {
+ t.Errorf("Expected 0 QClass, got %d", x)
+ }
+
+ if x := st.QName(); x != "." {
+ t.Errorf("Expected . Qname, got %s", x)
+ }
+
+ if x := st.Name(); x != "." {
+ t.Errorf("Expected . Name, got %s", x)
+ }
+
+ if x := st.Type(); x != "" {
+ t.Errorf("Expected empty Type, got %s", x)
+ }
+
+ if x := st.Class(); x != "" {
+ t.Errorf("Expected empty Class, got %s", x)
+ }
+}
+
func BenchmarkRequestDo(b *testing.B) {
st := testRequest()