From ae0310d88e0ddaec8756eea7fbf6b8230793c7a8 Mon Sep 17 00:00:00 2001 From: GrĂ©goire DuchĂȘne Date: Sun, 5 Nov 2023 09:14:26 +0000 Subject: Remove external dependencies There have been bogus Dependabot alerts for what is essentially an archived project. --- pipeln_test.go | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) (limited to 'pipeln_test.go') diff --git a/pipeln_test.go b/pipeln_test.go index 3b822b2..85aaef7 100644 --- a/pipeln_test.go +++ b/pipeln_test.go @@ -4,16 +4,13 @@ package pipeln import ( "context" + "errors" "net/http" "syscall" "testing" - - "go.awhk.org/core" ) -func Test(s *testing.T) { - t := core.T{T: s} - +func Test(t *testing.T) { ln := New("test:80") mux := http.NewServeMux() mux.HandleFunc("/endpoint", func(w http.ResponseWriter, _ *http.Request) { @@ -24,26 +21,36 @@ func Test(s *testing.T) { client := http.Client{Transport: &http.Transport{Dial: ln.Dial}} - t.Run("OK", func(t *core.T) { + t.Run("OK", func(t *testing.T) { resp, err := client.Get("http://test/endpoint") - t.AssertErrorIs(nil, err) - t.AssertEqual(http.StatusOK, resp.StatusCode) + if err != nil { + t.Fatal(err) + } + if resp.StatusCode != http.StatusOK { + t.Error(resp.StatusCode) + } }) - t.Run("Address Mismatch", func(t *core.T) { + t.Run("Address Mismatch", func(t *testing.T) { _, err := client.Get("http://other-test/endpoint") - t.AssertErrorIs(syscall.EINVAL, err) + if !errors.Is(err, syscall.EINVAL) { + t.Fatal(err) + } }) srv.Shutdown(context.Background()) - t.Run("Remote Connection Closed", func(t *core.T) { + t.Run("Remote Connection Closed", func(t *testing.T) { _, err := client.Get("http://test/endpoint") - t.AssertErrorIs(syscall.ECONNREFUSED, err) + if !errors.Is(err, syscall.ECONNREFUSED) { + t.Fatal(err) + } }) - t.Run("Already-closed Listener", func(t *core.T) { + t.Run("Already-closed Listener", func(t *testing.T) { srv = http.Server{Handler: mux} - t.AssertErrorIs(syscall.EINVAL, srv.Serve(ln)) + if err := srv.Serve(ln); !errors.Is(err, syscall.EINVAL) { + t.Fatal(err) + } }) } -- cgit v1.2.3-70-g09d2