Skip to content

Commit 42b246c

Browse files
committed
Remove duplicate test cases
1 parent d107719 commit 42b246c

File tree

1 file changed

+7
-41
lines changed

1 file changed

+7
-41
lines changed

daze_test.go

Lines changed: 7 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,14 @@ const (
1515
HostLookup = "google.com"
1616
)
1717

18-
func TestLocaleHTTP(t *testing.T) {
18+
func TestLocaleHttp(t *testing.T) {
1919
locale := NewLocale(DazeServerListenOn, &Direct{})
2020
defer locale.Close()
2121
locale.Run()
2222

2323
cmd := exec.Command("curl", "-x", "http://"+DazeServerListenOn, CurlDest)
2424
out := doa.Try(cmd.Output())
25-
if !bytes.Contains(out, []byte("zhihu")) {
26-
t.FailNow()
27-
}
25+
doa.Doa(bytes.Contains(out, []byte("zhihu")))
2826
}
2927

3028
func TestLocaleSocks4(t *testing.T) {
@@ -34,9 +32,7 @@ func TestLocaleSocks4(t *testing.T) {
3432

3533
cmd := exec.Command("curl", "-x", "socks4://"+DazeServerListenOn, CurlDest)
3634
out := doa.Try(cmd.Output())
37-
if !bytes.Contains(out, []byte("zhihu")) {
38-
t.FailNow()
39-
}
35+
doa.Doa(bytes.Contains(out, []byte("zhihu")))
4036
}
4137

4238
func TestLocaleSocks4a(t *testing.T) {
@@ -46,9 +42,7 @@ func TestLocaleSocks4a(t *testing.T) {
4642

4743
cmd := exec.Command("curl", "-x", "socks4a://"+DazeServerListenOn, CurlDest)
4844
out := doa.Try(cmd.Output())
49-
if !bytes.Contains(out, []byte("zhihu")) {
50-
t.FailNow()
51-
}
45+
doa.Doa(bytes.Contains(out, []byte("zhihu")))
5246
}
5347

5448
func TestLocaleSocks5(t *testing.T) {
@@ -58,33 +52,7 @@ func TestLocaleSocks5(t *testing.T) {
5852

5953
cmd := exec.Command("curl", "-x", "socks5://"+DazeServerListenOn, CurlDest)
6054
out := doa.Try(cmd.Output())
61-
if !bytes.Contains(out, []byte("zhihu")) {
62-
t.FailNow()
63-
}
64-
}
65-
66-
func TestResolverDns(t *testing.T) {
67-
dns := ResolverDns(ResolverPublic.Cloudflare.Dns)
68-
_, err := dns.LookupHost(context.Background(), HostLookup)
69-
if err != nil {
70-
t.FailNow()
71-
}
72-
}
73-
74-
func TestResolverDot(t *testing.T) {
75-
dot := ResolverDot(ResolverPublic.Cloudflare.Dot)
76-
_, err := dot.LookupHost(context.Background(), HostLookup)
77-
if err != nil {
78-
t.FailNow()
79-
}
80-
}
81-
82-
func TestResolverDoh(t *testing.T) {
83-
doh := ResolverDoh(ResolverPublic.Cloudflare.Doh)
84-
_, err := doh.LookupHost(context.Background(), HostLookup)
85-
if err != nil {
86-
t.FailNow()
87-
}
55+
doa.Doa(bytes.Contains(out, []byte("zhihu")))
8856
}
8957

9058
func TestResolverAll(t *testing.T) {
@@ -103,9 +71,7 @@ func TestResolverAll(t *testing.T) {
10371
ResolverPublic.Tencent.Doh,
10472
} {
10573
dns := ResolverAny(url)
106-
_, err := dns.LookupHost(context.Background(), HostLookup)
107-
if err != nil {
108-
t.FailNow()
109-
}
74+
err := doa.Err(dns.LookupHost(context.Background(), HostLookup))
75+
doa.Nil(err)
11076
}
11177
}

0 commit comments

Comments
 (0)