Repository navigation
Expand file tree
/
Copy pathResponseCode_test.go
More file actions
55 lines (44 loc) · 1.89 KB
/
Copy pathResponseCode_test.go
File metadata and controls
55 lines (44 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package dns
import "testing"
func TestResponseCode(t *testing.T) {
t.Run("String(NoError)", func(t *testing.T) {
if ResponseCode(ResponseCodeNoError).String() != "No Error" {
t.Errorf("Expected '%s' but got '%s'", "No Error", ResponseCode(ResponseCodeNoError).String())
}
})
t.Run("String(FormatError)", func(t *testing.T) {
if ResponseCode(ResponseCodeFormatError).String() != "Format Error" {
t.Errorf("Expected '%s' but got '%s'", "Format Error", ResponseCode(ResponseCodeFormatError).String())
}
})
t.Run("String(ServerFailure)", func(t *testing.T) {
if ResponseCode(ResponseCodeServerFailure).String() != "Server Failure" {
t.Errorf("Expected '%s' but got '%s'", "Server Failure", ResponseCode(ResponseCodeServerFailure).String())
}
})
t.Run("String(NonExistDomain)", func(t *testing.T) {
if ResponseCode(ResponseCodeNonExistDomain).String() != "Non-Existent Domain" {
t.Errorf("Expected '%s' but got '%s'", "Non-Existent Domain", ResponseCode(ResponseCodeNonExistDomain).String())
}
})
t.Run("String(NotImplemented)", func(t *testing.T) {
if ResponseCode(ResponseCodeNotImplemented).String() != "Not Implemented" {
t.Errorf("Expected '%s' but got '%s'", "Not Implemented", ResponseCode(ResponseCodeNotImplemented).String())
}
})
t.Run("String(QueryRefused)", func(t *testing.T) {
if ResponseCode(ResponseCodeQueryRefused).String() != "Query Refused" {
t.Errorf("Expected '%s' but got '%s'", "Query Refused", ResponseCode(ResponseCodeQueryRefused).String())
}
})
t.Run("String(BadCookie)", func(t *testing.T) {
if ResponseCode(ResponseCodeBadCookie).String() != "Bad Cookie" {
t.Errorf("Expected '%s' but got '%s'", "Bad Cookie", ResponseCode(ResponseCodeBadCookie).String())
}
})
t.Run("String(unknown)", func(t *testing.T) {
if ResponseCode(100).String() != "" {
t.Errorf("Expected '%s' but got '%s'", "", ResponseCode(100).String())
}
})
}