Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for TestPtrSetNil (0.11 sec)

  1. src/internal/reflectlite/all_test.go

    	for i, test := range valueToStringTests {
    		s := valueToString(ValueOf(test.i))
    		if s != test.s {
    			t.Errorf("#%d: have %#q, want %#q", i, s, test.s)
    		}
    	}
    }
    
    func TestPtrSetNil(t *testing.T) {
    	var i int32 = 1234
    	ip := &i
    	vip := ValueOf(&ip)
    	vip.Elem().Set(Zero(vip.Elem().Type()))
    	if ip != nil {
    		t.Errorf("got non-nil (%d), want nil", *ip)
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Nov 16 19:26:08 UTC 2023
    - 24.2K bytes
    - Viewed (0)
  2. src/reflect/all_test.go

    		t.Errorf("got %d, want 1234", *ip)
    	}
    
    	ip = nil
    	vp := ValueOf(&ip).Elem()
    	vp.Set(Zero(vp.Type()))
    	if ip != nil {
    		t.Errorf("got non-nil (%p), want nil", ip)
    	}
    }
    
    func TestPtrSetNil(t *testing.T) {
    	var i int32 = 1234
    	ip := &i
    	vip := ValueOf(&ip)
    	vip.Elem().Set(Zero(vip.Elem().Type()))
    	if ip != nil {
    		t.Errorf("got non-nil (%d), want nil", *ip)
    	}
    }
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu May 23 01:00:11 UTC 2024
    - 218.8K bytes
    - Viewed (0)
Back to top