Skip to content

Commit 13e4478

Browse files
author
Vic Shóstak
committed
Fix tests
1 parent ef2a920 commit 13e4478

File tree

5 files changed

+12
-11
lines changed

5 files changed

+12
-11
lines changed

concatenators.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func Concat(s ...string) string {
3434
n += len(s[i])
3535
}
3636

37-
b := make([]byte, n, n)
37+
b := make([]byte, n)
3838

3939
idx := 0
4040
for i := 0; i < len(s); i++ {

converters_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ func BenchmarkToBytes_HelloWorld(b *testing.B) {
2727
}
2828

2929
func TestToString(t *testing.T) {
30-
s, err := ToString(nil)
30+
_, err := ToString(nil)
3131
require.Error(t, err)
3232

33-
s, err = ToString([]byte(`hello, world`))
33+
s, err := ToString([]byte(`hello, world`))
3434
require.NoError(t, err)
3535
assert.EqualValues(t, s, "hello, world", "should be equal")
3636
assert.NotEqual(t, s, "wrong", "should not be equal")
@@ -47,10 +47,10 @@ func TestToString(t *testing.T) {
4747
}
4848

4949
func TestToBytes(t *testing.T) {
50-
b, err := ToBytes("")
50+
_, err := ToBytes("")
5151
require.Error(t, err)
5252

53-
b, err = ToBytes("hello, world")
53+
b, err := ToBytes("hello, world")
5454
require.NoError(t, err)
5555
assert.EqualValues(t, b, []byte(`hello, world`), "should be equal")
5656
assert.NotEqual(t, b, []byte(`wrong`), "should not be equal")

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ require (
99

1010
require (
1111
github.com/davecgh/go-spew v1.1.1 // indirect
12-
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
12+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
1313
github.com/modern-go/reflect2 v1.0.2 // indirect
1414
github.com/pmezard/go-difflib v1.0.0 // indirect
1515
gopkg.in/yaml.v3 v3.0.1 // indirect

go.sum

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
44
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
55
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
66
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
7-
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
87
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
8+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
9+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
910
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
1011
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
1112
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=

json_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func BenchmarkMarshal_StructField_4(b *testing.B) {
1818
u := &user{}
1919

2020
for i := 0; i < b.N; i++ {
21-
Marshal[user](u)
21+
Marshal(u)
2222
}
2323
}
2424

@@ -45,7 +45,7 @@ func BenchmarkMarshal_StructField_16(b *testing.B) {
4545
u := &user{}
4646

4747
for i := 0; i < b.N; i++ {
48-
Marshal[user](u)
48+
Marshal(u)
4949
}
5050
}
5151

@@ -61,7 +61,7 @@ func BenchmarkUnmarshal_StructField_4(b *testing.B) {
6161
d := []byte(`{"id":1,"name":"Viktor","email":"[email protected]"}`)
6262

6363
for i := 0; i < b.N; i++ {
64-
Unmarshal[user](d, u)
64+
Unmarshal(d, u)
6565
}
6666
}
6767

@@ -89,7 +89,7 @@ func BenchmarkUnmarshal_StructField_16(b *testing.B) {
8989
d := []byte(`{"id":1,"name":"Viktor","email":"[email protected]","attr_1":"one","attr_2":"two","attr_3":"three","attr_4":"four","attr_5":"five","attr_6":"six","attr_7":"seven","attr_8":"eight","rel_1":"one","rel_2":"two","rel_3":"three","rel_4":"four",}`)
9090

9191
for i := 0; i < b.N; i++ {
92-
Unmarshal[user](d, u)
92+
Unmarshal(d, u)
9393
}
9494
}
9595

0 commit comments

Comments
 (0)