Skip to content

Commit c8eaf46

Browse files
committed
remove reference to v2pro
1 parent 3fc4794 commit c8eaf46

15 files changed

+80
-70
lines changed

reflect2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package reflect2
33
import (
44
"reflect"
55
"unsafe"
6-
"github.com/v2pro/plz/concurrent"
6+
"github.com/modern-go/concurrent"
77
)
88

99
type Type interface {

test/int_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ package test
33
import (
44
"testing"
55
"github.com/modern-go/reflect2"
6-
"github.com/v2pro/plz/test"
7-
"github.com/v2pro/plz/countlog"
6+
"github.com/modern-go/test"
87
"unsafe"
9-
"github.com/v2pro/plz/test/must"
8+
"github.com/modern-go/test/must"
9+
"context"
1010
)
1111

1212
func Test_int(t *testing.T) {
@@ -16,17 +16,17 @@ func Test_int(t *testing.T) {
1616
*obj.(*int) = 100
1717
return obj
1818
}))
19-
t.Run("PackEFace", test.Case(func(ctx *countlog.Context) {
19+
t.Run("PackEFace", test.Case(func(ctx context.Context) {
2020
valType := reflect2.TypeOf(1)
2121
hundred := 100
2222
must.Equal(&hundred, valType.PackEFace(unsafe.Pointer(&hundred)))
2323
}))
24-
t.Run("Indirect", test.Case(func(ctx *countlog.Context) {
24+
t.Run("Indirect", test.Case(func(ctx context.Context) {
2525
valType := reflect2.TypeOf(1)
2626
hundred := 100
2727
must.Equal(100, valType.Indirect(&hundred))
2828
}))
29-
t.Run("Indirect", test.Case(func(ctx *countlog.Context) {
29+
t.Run("Indirect", test.Case(func(ctx context.Context) {
3030
valType := reflect2.TypeOf(1)
3131
hundred := 100
3232
must.Equal(100, valType.UnsafeIndirect(unsafe.Pointer(&hundred)))

test/map_elem_bytes_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ package test
33
import (
44
"testing"
55
"github.com/modern-go/reflect2"
6-
"github.com/v2pro/plz/test"
7-
"github.com/v2pro/plz/countlog"
8-
"github.com/v2pro/plz/test/must"
6+
"github.com/modern-go/test"
7+
"github.com/modern-go/test/must"
8+
"context"
99
)
1010

1111
func Test_map_elem_bytes(t *testing.T) {
@@ -16,7 +16,7 @@ func Test_map_elem_bytes(t *testing.T) {
1616
valType.SetIndex(obj, 3, nil)
1717
return obj
1818
}))
19-
t.Run("UnsafeSetIndex", test.Case(func(ctx *countlog.Context) {
19+
t.Run("UnsafeSetIndex", test.Case(func(ctx context.Context) {
2020
obj := map[int][]byte{}
2121
valType := reflect2.TypeOf(obj).(reflect2.MapType)
2222
hello := []byte("hello")
@@ -25,7 +25,7 @@ func Test_map_elem_bytes(t *testing.T) {
2525
must.Equal([]byte("hello"), obj[2])
2626
must.Nil(obj[3])
2727
}))
28-
t.Run("UnsafeGetIndex", test.Case(func(ctx *countlog.Context) {
28+
t.Run("UnsafeGetIndex", test.Case(func(ctx context.Context) {
2929
obj := map[int][]byte{2: []byte("hello")}
3030
valType := reflect2.TypeOf(obj).(reflect2.MapType)
3131
elem := valType.UnsafeGetIndex(reflect2.PtrOf(obj), reflect2.PtrOf(2))

test/map_elem_eface_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ package test
33
import (
44
"testing"
55
"github.com/modern-go/reflect2"
6-
"github.com/v2pro/plz/test/must"
7-
"github.com/v2pro/plz/countlog"
8-
"github.com/v2pro/plz/test"
6+
"github.com/modern-go/test/must"
7+
8+
"github.com/modern-go/test"
9+
"context"
910
)
1011

1112
func Test_map_elem_eface(t *testing.T) {
@@ -25,7 +26,7 @@ func Test_map_elem_eface(t *testing.T) {
2526
valType.GetIndex(obj, 0),
2627
}
2728
}))
28-
t.Run("TryGetIndex", test.Case(func(ctx *countlog.Context) {
29+
t.Run("TryGetIndex", test.Case(func(ctx context.Context) {
2930
obj := map[int]interface{}{3: 9, 2: nil}
3031
valType := reflect2.TypeOf(obj).(reflect2.MapType)
3132
elem, found := valType.TryGetIndex(obj, 3)

test/map_key_eface_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package test
33
import (
44
"testing"
55
"github.com/modern-go/reflect2"
6-
"github.com/v2pro/plz/test/must"
6+
"github.com/modern-go/test/must"
77
)
88

99
func Test_map_key_eface(t *testing.T) {

test/map_key_iface_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package test
33
import (
44
"testing"
55
"github.com/modern-go/reflect2"
6-
"github.com/v2pro/plz/test/must"
6+
"github.com/modern-go/test/must"
77
)
88

99
type intError int

test/map_key_ptr_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ package test
33
import (
44
"testing"
55
"github.com/modern-go/reflect2"
6-
"github.com/v2pro/plz/test/must"
7-
"github.com/v2pro/plz/test"
8-
"github.com/v2pro/plz/countlog"
6+
"github.com/modern-go/test/must"
7+
"github.com/modern-go/test"
8+
99
"unsafe"
10+
"context"
1011
)
1112

1213
func Test_map_key_ptr(t *testing.T) {
@@ -22,7 +23,7 @@ func Test_map_key_ptr(t *testing.T) {
2223
//valType.SetIndex(obj, nil, 9)
2324
return obj[pInt(2)]
2425
}))
25-
t.Run("UnsafeSetIndex", test.Case(func(ctx *countlog.Context) {
26+
t.Run("UnsafeSetIndex", test.Case(func(ctx context.Context) {
2627
obj := map[*int]int{}
2728
valType := reflect2.TypeOf(obj).(reflect2.MapType)
2829
v := pInt(2)

test/map_test.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ package test
33
import (
44
"testing"
55
"github.com/modern-go/reflect2"
6-
"github.com/v2pro/plz/test/must"
7-
"github.com/v2pro/plz/countlog"
8-
"github.com/v2pro/plz/test"
6+
"github.com/modern-go/test/must"
7+
8+
"github.com/modern-go/test"
99
"unsafe"
1010
"reflect"
11+
"context"
1112
)
1213

1314
func Test_map(t *testing.T) {
@@ -35,13 +36,13 @@ func Test_map(t *testing.T) {
3536
m[3] = 9
3637
return m
3738
}))
38-
t.Run("UnsafeMakeMap", test.Case(func(ctx *countlog.Context) {
39+
t.Run("UnsafeMakeMap", test.Case(func(ctx context.Context) {
3940
valType := reflect2.TypeOf(map[int]int{}).(reflect2.MapType)
4041
m := *(*map[int]int)(valType.UnsafeMakeMap(0))
4142
m[2] = 4
4243
m[3] = 9
4344
}))
44-
t.Run("PackEFace", test.Case(func(ctx *countlog.Context) {
45+
t.Run("PackEFace", test.Case(func(ctx context.Context) {
4546
valType := reflect2.TypeOf(map[int]int{}).(reflect2.MapType)
4647
m := valType.UnsafeMakeMap(0)
4748
must.Equal(&map[int]int{}, valType.PackEFace(unsafe.Pointer(m)))
@@ -58,7 +59,7 @@ func Test_map(t *testing.T) {
5859
must.Equal(4, obj[2])
5960
return obj
6061
}))
61-
t.Run("UnsafeSetIndex", test.Case(func(ctx *countlog.Context) {
62+
t.Run("UnsafeSetIndex", test.Case(func(ctx context.Context) {
6263
obj := map[int]int{}
6364
valType := reflect2.TypeOf(obj).(reflect2.MapType)
6465
valType.UnsafeSetIndex(unsafe.Pointer(&obj), reflect2.PtrOf(2), reflect2.PtrOf(4))
@@ -72,7 +73,7 @@ func Test_map(t *testing.T) {
7273
valType.GetIndex(&obj, pInt(0)).(*int),
7374
}
7475
}))
75-
t.Run("UnsafeGetIndex", test.Case(func(ctx *countlog.Context) {
76+
t.Run("UnsafeGetIndex", test.Case(func(ctx context.Context) {
7677
obj := map[int]int{3: 9, 2: 4}
7778
valType := reflect2.TypeOf(obj).(reflect2.MapType)
7879
elem := valType.UnsafeGetIndex(unsafe.Pointer(&obj), reflect2.PtrOf(3))
@@ -87,7 +88,7 @@ func Test_map(t *testing.T) {
8788
must.Pass(!iter.HasNext(), "api", api)
8889
return []interface{}{key1, elem1}
8990
}))
90-
t.Run("UnsafeIterate", test.Case(func(ctx *countlog.Context) {
91+
t.Run("UnsafeIterate", test.Case(func(ctx context.Context) {
9192
obj := map[int]int{2: 4}
9293
valType := reflect2.TypeOf(obj).(reflect2.MapType)
9394
iter := valType.UnsafeIterate(unsafe.Pointer(&obj))

test/op_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@ package test
33
import (
44
"github.com/modern-go/reflect2"
55
"testing"
6-
"github.com/v2pro/plz/countlog"
7-
"github.com/v2pro/plz/test/must"
8-
"github.com/v2pro/plz/test"
6+
7+
"github.com/modern-go/test/must"
8+
"github.com/modern-go/test"
9+
"context"
910
)
1011

1112
func testOp(f func(api reflect2.API) interface{}) func(t *testing.T) {
12-
return test.Case(func(ctx *countlog.Context) {
13+
return test.Case(func(ctx context.Context) {
1314
unsafeResult := f(reflect2.ConfigUnsafe)
1415
safeResult := f(reflect2.ConfigSafe)
1516
must.Equal(safeResult, unsafeResult)

test/slice_eface_test.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ package test
33
import (
44
"testing"
55
"github.com/modern-go/reflect2"
6-
"github.com/v2pro/plz/test"
7-
"github.com/v2pro/plz/countlog"
8-
"github.com/v2pro/plz/test/must"
6+
"github.com/modern-go/test"
7+
8+
"github.com/modern-go/test/must"
99
"unsafe"
10-
"github.com/v2pro/plz/test/should"
10+
"github.com/modern-go/test/should"
1111
"fmt"
12+
"context"
1213
)
1314

1415
func Test_slice_eface(t *testing.T) {
@@ -28,7 +29,7 @@ func Test_slice_eface(t *testing.T) {
2829
valType.SetIndex(obj, 1, &elem1)
2930
return obj
3031
}))
31-
t.Run("UnsafeSetIndex", test.Case(func(ctx *countlog.Context) {
32+
t.Run("UnsafeSetIndex", test.Case(func(ctx context.Context) {
3233
obj := []interface{}{1, 2}
3334
valType := reflect2.TypeOf(obj).(reflect2.SliceType)
3435
var elem0 interface{} = 100
@@ -46,7 +47,7 @@ func Test_slice_eface(t *testing.T) {
4647
valType.GetIndex(obj, 1),
4748
}
4849
}))
49-
t.Run("UnsafeGetIndex", test.Case(func(ctx *countlog.Context) {
50+
t.Run("UnsafeGetIndex", test.Case(func(ctx context.Context) {
5051
obj := []interface{}{1, nil}
5152
valType := reflect2.TypeOf(obj).(reflect2.SliceType)
5253
elem0 := valType.UnsafeGetIndex(reflect2.PtrOf(obj), 0)
@@ -62,7 +63,7 @@ func Test_slice_eface(t *testing.T) {
6263
valType.Append(&obj, 4)
6364
return obj
6465
}))
65-
t.Run("UnsafeAppend", test.Case(func(ctx *countlog.Context) {
66+
t.Run("UnsafeAppend", test.Case(func(ctx context.Context) {
6667
obj := make([]interface{}, 2, 3)
6768
obj[0] = 1
6869
obj[1] = 2

0 commit comments

Comments
 (0)