Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/update deps and add tests #58

Merged
merged 5 commits into from
Jul 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
linters:
enable:
- nilerr
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ check: fmt lint vet
.PHONY: download-ci-tools
download-ci-tools:
go install golang.org/x/tools/cmd/goimports@latest
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.50.1
curl -sSfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s v0.14.1
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.53.1
curl -sSfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s v0.14.2

.PHONY: fmt
fmt:
Expand All @@ -19,11 +19,11 @@ fmt:

.PHONY: lint
lint:
./bin/golangci-lint run ./...
./bin/golangci-lint run

.PHONY: lint-ci
lint-ci:
./bin/golangci-lint run ./... | \
./bin/golangci-lint run | \
./bin/reviewdog -f=golangci-lint -reporter=github-pr-review -filter-mode=nofilter

.PHONY: vet
Expand Down
22 changes: 11 additions & 11 deletions chunk_header_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"bytes"
"testing"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)

func TestChunkBasicHeader(t *testing.T) {
Expand Down Expand Up @@ -116,8 +116,8 @@ func TestChunkBasicHeader(t *testing.T) {

buf := new(bytes.Buffer)
err := encodeChunkBasicHeader(buf, tc.value)
assert.Nil(t, err)
assert.Equal(t, tc.binary, buf.Bytes())
require.Nil(t, err)
require.Equal(t, tc.binary, buf.Bytes())
})
}
})
Expand All @@ -132,8 +132,8 @@ func TestChunkBasicHeader(t *testing.T) {
r := bytes.NewReader(tc.binary)
var mh chunkBasicHeader
err := decodeChunkBasicHeader(r, nil, &mh)
assert.Nil(t, err)
assert.Equal(t, tc.value, &mh)
require.Nil(t, err)
require.Equal(t, tc.value, &mh)
})
}
})
Expand All @@ -146,7 +146,7 @@ func TestChunkBasicHeaderError(t *testing.T) {
fmt: 3,
chunkStreamID: 65600,
})
assert.EqualError(t, err, "Chunk stream id is out of range: 65600 must be in range [2, 65599]")
require.EqualError(t, err, "Chunk stream id is out of range: 65600 must be in range [2, 65599]")
})

t.Run("Out of range(under)", func(t *testing.T) {
Expand All @@ -155,7 +155,7 @@ func TestChunkBasicHeaderError(t *testing.T) {
fmt: 3,
chunkStreamID: 1,
})
assert.EqualError(t, err, "Chunk stream id is out of range: 1 must be in range [2, 65599]")
require.EqualError(t, err, "Chunk stream id is out of range: 1 must be in range [2, 65599]")
})
}

Expand Down Expand Up @@ -367,8 +367,8 @@ func TestChunkMessageHeader(t *testing.T) {

buf := new(bytes.Buffer)
err := encodeChunkMessageHeader(buf, tc.fmt, tc.value)
assert.Nil(t, err)
assert.Equal(t, tc.binary, buf.Bytes())
require.Nil(t, err)
require.Equal(t, tc.binary, buf.Bytes())
})
}
})
Expand All @@ -383,8 +383,8 @@ func TestChunkMessageHeader(t *testing.T) {
r := bytes.NewReader(tc.binary)
var mh chunkMessageHeader
err := decodeChunkMessageHeader(r, tc.fmt, nil, &mh)
assert.Nil(t, err)
assert.Equal(t, tc.value, &mh)
require.Nil(t, err)
require.Equal(t, tc.value, &mh)
})
}
})
Expand Down
Loading