File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,22 +11,20 @@ func TestNilPtr(t *testing.T) {
1111 t .Parallel ()
1212 t .Run ("should accept nil pointer & return nil" , func (t * testing.T ) {
1313 t .Parallel ()
14-
15- var nilPtr * int
16- assert .Nil (t , require .NilPtr ("Test pointer" , nilPtr ))
14+ assert .Nil (t , require .NilPtr ("Test pointer" , (* int )(nil )))
1715 })
1816 t .Run ("should panic when pointer is not nil" , func (t * testing.T ) {
19- t .Parallel ()
20-
2117 value := "test"
18+
19+ t .Parallel ()
2220 assert .PanicsWithValue (t , "assertion failed: Test pointer should be a nil pointer" , func () {
2321 require .NilPtr ("Test pointer" , & value )
2422 })
2523 })
2624 t .Run ("should use given name in panic message" , func (t * testing.T ) {
27- t .Parallel ()
28-
2925 value := 42
26+
27+ t .Parallel ()
3028 assert .PanicsWithValue (t , "assertion failed: Other value should be a nil pointer" , func () {
3129 require .NilPtr ("Other value" , & value )
3230 })
@@ -36,9 +34,9 @@ func TestNilPtr(t *testing.T) {
3634func TestNotNilPtr (t * testing.T ) {
3735 t .Parallel ()
3836 t .Run ("should accept not-nil pointer & return same pointer" , func (t * testing.T ) {
39- t .Parallel ()
40-
4137 value := 42
38+
39+ t .Parallel ()
4240 assert .Same (t , & value , require .NotNilPtr ("Test pointer" , & value ))
4341 })
4442 t .Run ("should panic when pointer is nil" , func (t * testing.T ) {
You can’t perform that action at this time.
0 commit comments