|
4 | 4 | "fmt" |
5 | 5 | "reflect" |
6 | 6 | "testing" |
| 7 | + "time" |
7 | 8 | ) |
8 | 9 |
|
9 | 10 | func Test_Pointer(t *testing.T) { |
@@ -69,6 +70,61 @@ func Test_Pointer(t *testing.T) { |
69 | 70 | fn: func(v interface{}) interface{} { return Int64(v.(int64)) }, |
70 | 71 | output: func() interface{} { i := int64(42); return &i }(), |
71 | 72 | }, |
| 73 | + { |
| 74 | + value: uintptr(42), |
| 75 | + fn: func(v interface{}) interface{} { return Uintptr(v.(uintptr)) }, |
| 76 | + output: func() interface{} { i := uintptr(42); return &i }(), |
| 77 | + }, |
| 78 | + { |
| 79 | + value: float32(42), |
| 80 | + fn: func(v interface{}) interface{} { return Float32(v.(float32)) }, |
| 81 | + output: func() interface{} { i := float32(42); return &i }(), |
| 82 | + }, |
| 83 | + { |
| 84 | + value: float64(42), |
| 85 | + fn: func(v interface{}) interface{} { return Float64(v.(float64)) }, |
| 86 | + output: func() interface{} { i := float64(42); return &i }(), |
| 87 | + }, |
| 88 | + { |
| 89 | + value: rune(42), |
| 90 | + fn: func(v interface{}) interface{} { return Rune(v.(rune)) }, |
| 91 | + output: func() interface{} { i := rune(42); return &i }(), |
| 92 | + }, |
| 93 | + { |
| 94 | + value: byte(42), |
| 95 | + fn: func(v interface{}) interface{} { return Byte(v.(byte)) }, |
| 96 | + output: func() interface{} { i := byte(42); return &i }(), |
| 97 | + }, |
| 98 | + { |
| 99 | + value: "42", |
| 100 | + fn: func(v interface{}) interface{} { return String(v.(string)) }, |
| 101 | + output: func() interface{} { i := "42"; return &i }(), |
| 102 | + }, |
| 103 | + { |
| 104 | + value: complex64(42), |
| 105 | + fn: func(v interface{}) interface{} { return Complex64(v.(complex64)) }, |
| 106 | + output: func() interface{} { i := complex64(42); return &i }(), |
| 107 | + }, |
| 108 | + { |
| 109 | + value: complex128(42), |
| 110 | + fn: func(v interface{}) interface{} { return Complex128(v.(complex128)) }, |
| 111 | + output: func() interface{} { i := complex128(42); return &i }(), |
| 112 | + }, |
| 113 | + { |
| 114 | + value: interface{}(42), |
| 115 | + fn: func(v interface{}) interface{} { return Interface(v) }, |
| 116 | + output: func() interface{} { i := interface{}(42); return &i }(), |
| 117 | + }, |
| 118 | + { |
| 119 | + value: time.Duration(42), |
| 120 | + fn: func(v interface{}) interface{} { return Duration(v.(time.Duration)) }, |
| 121 | + output: func() interface{} { i := time.Duration(42); return &i }(), |
| 122 | + }, |
| 123 | + { |
| 124 | + value: time.Time{}, |
| 125 | + fn: func(v interface{}) interface{} { return Time(v.(time.Time)) }, |
| 126 | + output: func() interface{} { i := time.Time{}; return &i }(), |
| 127 | + }, |
72 | 128 | } |
73 | 129 |
|
74 | 130 | for _, tc := range testCases { |
|
0 commit comments