@@ -3,11 +3,12 @@ package test
33import (
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
1314func 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 ))
0 commit comments