Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for TestNilPtrValueSub (0.25 sec)

  1. src/internal/reflectlite/all_test.go

    // If v is a nil pointer, Indirect returns a zero Value.
    // If v is not a pointer, Indirect returns v.
    func Indirect(v Value) Value {
    	if v.Kind() != Ptr {
    		return v
    	}
    	return v.Elem()
    }
    
    func TestNilPtrValueSub(t *testing.T) {
    	var pi *int
    	if pv := ValueOf(pi); pv.Elem().IsValid() {
    		t.Error("ValueOf((*int)(nil)).Elem().IsValid()")
    	}
    }
    
    type Point struct {
    	x, y int
    }
    
    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

    		W io.Writer
    	}
    
    	s.W = os.Stdout
    	v := Indirect(ValueOf(&s)).Field(0).Interface()
    	if v != s.W.(any) {
    		t.Error("Interface() on interface: ", v, s.W)
    	}
    }
    
    func TestNilPtrValueSub(t *testing.T) {
    	var pi *int
    	if pv := ValueOf(pi); pv.Elem().IsValid() {
    		t.Error("ValueOf((*int)(nil)).Elem().IsValid()")
    	}
    }
    
    func TestMap(t *testing.T) {
    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