diff options
| author | Grégoire Duchêne <gduchene@awhk.org> | 2022-07-31 14:12:55 +0100 |
|---|---|---|
| committer | Grégoire Duchêne <gduchene@awhk.org> | 2022-07-31 14:12:55 +0100 |
| commit | 2f1bc2074a2678f473086587e7a7c73224009983 (patch) | |
| tree | a13f3a8e6e7db18a570626c503de8b9d3eb99799 /pipeln_test.go | |
| parent | c949ffafd1cbe823f66654af6f04026edb44bf86 (diff) | |
Use go.awhk.org/core in testsv1.0.2
Diffstat (limited to 'pipeln_test.go')
| -rw-r--r-- | pipeln_test.go | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/pipeln_test.go b/pipeln_test.go index 9673fcc..dcbeb22 100644 --- a/pipeln_test.go +++ b/pipeln_test.go @@ -7,14 +7,15 @@ import ( "net/http" "testing" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" "golang.org/x/sys/unix" + + "go.awhk.org/core" ) -func Test(t *testing.T) { - ln := New("test:80") +func Test(s *testing.T) { + t := core.T{T: s} + ln := New("test:80") mux := http.NewServeMux() mux.HandleFunc("/endpoint", func(w http.ResponseWriter, _ *http.Request) { w.WriteHeader(http.StatusOK) @@ -24,26 +25,26 @@ func Test(t *testing.T) { client := http.Client{Transport: &http.Transport{Dial: ln.Dial}} - t.Run("OK", func(t *testing.T) { + t.Run("OK", func(t *core.T) { resp, err := client.Get("http://test/endpoint") - require.NoError(t, err) - assert.Equal(t, http.StatusOK, resp.StatusCode) + t.AssertErrorIs(nil, err) + t.AssertEqual(http.StatusOK, resp.StatusCode) }) - t.Run("Address Mismatch", func(t *testing.T) { + t.Run("Address Mismatch", func(t *core.T) { _, err := client.Get("http://other-test/endpoint") - assert.ErrorIs(t, err, unix.EINVAL) + t.AssertErrorIs(unix.EINVAL, err) }) srv.Shutdown(context.Background()) - t.Run("Remote Connection Closed", func(t *testing.T) { + t.Run("Remote Connection Closed", func(t *core.T) { _, err := client.Get("http://test/endpoint") - assert.ErrorIs(t, err, unix.ECONNREFUSED) + t.AssertErrorIs(unix.ECONNREFUSED, err) }) - t.Run("Already-closed Listener", func(t *testing.T) { + t.Run("Already-closed Listener", func(t *core.T) { srv = http.Server{Handler: mux} - assert.ErrorIs(t, srv.Serve(ln), unix.EINVAL) + t.AssertErrorIs(unix.EINVAL, srv.Serve(ln)) }) } |
