@@ -62,6 +62,14 @@ func TestFieldImpl_PointerInt(t *testing.T) {
6262 if * value != expected {
6363 t .Errorf (`TestFieldImpl_PointerInt - expected field "PointerInteger" to be equal %#v but got %#v` , expected , * value )
6464 }
65+
66+ reader = NewReader (testStruct {})
67+
68+ value = reader .GetField ("PointerInteger" ).PointerInt ()
69+
70+ if value != nil {
71+ t .Errorf (`TestFieldImpl_PointerInt - expected field "PointerInteger" to be nil but got %#v` , * value )
72+ }
6573}
6674
6775func TestFieldImpl_Int (t * testing.T ) {
@@ -90,6 +98,14 @@ func TestFieldImpl_PointerInt8(t *testing.T) {
9098 if * value != int8 (expected ) {
9199 t .Errorf (`TestFieldImpl_PointerInt8 - expected field "PointerInteger" to be equal %#v but got %#v` , expected , * value )
92100 }
101+
102+ reader = NewReader (testStruct {})
103+
104+ value = reader .GetField ("PointerInteger" ).PointerInt8 ()
105+
106+ if value != nil {
107+ t .Errorf (`TestFieldImpl_PointerInt8 - expected field "PointerInteger" to be nil but got %#v` , * value )
108+ }
93109}
94110
95111func TestFieldImpl_Int8 (t * testing.T ) {
@@ -118,6 +134,14 @@ func TestFieldImpl_PointerInt16(t *testing.T) {
118134 if * value != int16 (expected ) {
119135 t .Errorf (`TestFieldImpl_PointerInt16 - expected field "PointerInteger" to be equal %#v but got %#v` , expected , * value )
120136 }
137+
138+ reader = NewReader (testStruct {})
139+
140+ value = reader .GetField ("PointerInteger" ).PointerInt16 ()
141+
142+ if value != nil {
143+ t .Errorf (`TestFieldImpl_PointerInt16 - expected field "PointerInteger" to be nil but got %#v` , * value )
144+ }
121145}
122146
123147func TestFieldImpl_Int16 (t * testing.T ) {
@@ -146,6 +170,14 @@ func TestFieldImpl_PointerInt32(t *testing.T) {
146170 if * value != int32 (expected ) {
147171 t .Errorf (`TestFieldImpl_PointerInt32 - expected field "PointerInteger" to be equal %#v but got %#v` , expected , * value )
148172 }
173+
174+ reader = NewReader (testStruct {})
175+
176+ value = reader .GetField ("PointerInteger" ).PointerInt32 ()
177+
178+ if value != nil {
179+ t .Errorf (`TestFieldImpl_PointerInt32 - expected field "PointerInteger" to be nil but got %#v` , * value )
180+ }
149181}
150182
151183func TestFieldImpl_Int32 (t * testing.T ) {
@@ -174,6 +206,14 @@ func TestFieldImpl_PointerInt64(t *testing.T) {
174206 if * value != int64 (expected ) {
175207 t .Errorf (`TestFieldImpl_PointerInt64 - expected field "PointerInteger" to be equal %#v but got %#v` , expected , * value )
176208 }
209+
210+ reader = NewReader (testStruct {})
211+
212+ value = reader .GetField ("PointerInteger" ).PointerInt64 ()
213+
214+ if value != nil {
215+ t .Errorf (`TestFieldImpl_PointerInt64 - expected field "PointerInteger" to be nil but got %#v` , * value )
216+ }
177217}
178218
179219func TestFieldImpl_Int64 (t * testing.T ) {
@@ -190,6 +230,28 @@ func TestFieldImpl_Int64(t *testing.T) {
190230 }
191231}
192232
233+ func TestFieldImpl_PointerUint (t * testing.T ) {
234+ expected := uint (123 )
235+
236+ reader := NewReader (testStruct {
237+ PointerUinteger : & expected ,
238+ })
239+
240+ value := reader .GetField ("PointerUinteger" ).PointerUint ()
241+
242+ if * value != expected {
243+ t .Errorf (`TestFieldImpl_PointerUint - expected field "PointerUinteger" to be equal %#v but got %#v` , expected , * value )
244+ }
245+
246+ reader = NewReader (testStruct {})
247+
248+ value = reader .GetField ("PointerUinteger" ).PointerUint ()
249+
250+ if value != nil {
251+ t .Errorf (`TestFieldImpl_PointerUint - expected field "PointerUinteger" to be nil but got %#v` , * value )
252+ }
253+ }
254+
193255func TestFieldImpl_Uint (t * testing.T ) {
194256 expected := uint (123 )
195257
@@ -216,6 +278,14 @@ func TestFieldImpl_PointerUint8(t *testing.T) {
216278 if * value != uint8 (expected ) {
217279 t .Errorf (`TestFieldImpl_PointerUint8 - expected field "PointerUinteger" to be equal %#v but got %#v` , expected , * value )
218280 }
281+
282+ reader = NewReader (testStruct {})
283+
284+ value = reader .GetField ("PointerUinteger" ).PointerUint8 ()
285+
286+ if value != nil {
287+ t .Errorf (`TestFieldImpl_PointerUint8 - expected field "PointerUinteger" to be nil but got %#v` , * value )
288+ }
219289}
220290
221291func TestFieldImpl_Uint8 (t * testing.T ) {
@@ -244,6 +314,14 @@ func TestFieldImpl_PointerUint16(t *testing.T) {
244314 if * value != uint16 (expected ) {
245315 t .Errorf (`TestFieldImpl_PointerUint16 - expected field "PointerUinteger" to be equal %#v but got %#v` , expected , * value )
246316 }
317+
318+ reader = NewReader (testStruct {})
319+
320+ value = reader .GetField ("PointerUinteger" ).PointerUint16 ()
321+
322+ if value != nil {
323+ t .Errorf (`TestFieldImpl_PointerUint16 - expected field "PointerUinteger" to be nil but got %#v` , * value )
324+ }
247325}
248326
249327func TestFieldImpl_Uint16 (t * testing.T ) {
@@ -272,6 +350,14 @@ func TestFieldImpl_PointerUint32(t *testing.T) {
272350 if * value != uint32 (expected ) {
273351 t .Errorf (`TestFieldImpl_PointerUint32 - expected field "PointerUinteger" to be equal %#v but got %#v` , expected , * value )
274352 }
353+
354+ reader = NewReader (testStruct {})
355+
356+ value = reader .GetField ("PointerUinteger" ).PointerUint32 ()
357+
358+ if value != nil {
359+ t .Errorf (`TestFieldImpl_PointerUint32 - expected field "PointerUinteger" to be nil but got %#v` , * value )
360+ }
275361}
276362
277363func TestFieldImpl_Uint32 (t * testing.T ) {
@@ -300,6 +386,14 @@ func TestFieldImpl_PointerUint64(t *testing.T) {
300386 if * value != uint64 (expected ) {
301387 t .Errorf (`TestFieldImpl_PointerUint64 - expected field "PointerUinteger" to be equal %#v but got %#v` , expected , * value )
302388 }
389+
390+ reader = NewReader (testStruct {})
391+
392+ value = reader .GetField ("PointerUinteger" ).PointerUint64 ()
393+
394+ if value != nil {
395+ t .Errorf (`TestFieldImpl_PointerUint64 - expected field "PointerUinteger" to be nil but got %#v` , * value )
396+ }
303397}
304398
305399func TestFieldImpl_Uint64 (t * testing.T ) {
@@ -328,6 +422,14 @@ func TestFieldImpl_PointerFloat32(t *testing.T) {
328422 if * value != float32 (expected ) {
329423 t .Errorf (`TestFieldImpl_PointerFloat32 - expected field "PointerFloat" to be equal %#v but got %#v` , expected , * value )
330424 }
425+
426+ reader = NewReader (testStruct {})
427+
428+ value = reader .GetField ("PointerFloat" ).PointerFloat32 ()
429+
430+ if value != nil {
431+ t .Errorf (`TestFieldImpl_PointerFloat32 - expected field "PointerFloat" to be nil but got %#v` , * value )
432+ }
331433}
332434
333435func TestFieldImpl_Float32 (t * testing.T ) {
@@ -356,6 +458,14 @@ func TestFieldImpl_PointerFloat64(t *testing.T) {
356458 if * value != expected {
357459 t .Errorf (`TestFieldImpl_PointerFloat64 - expected field "PointerFloat" to be equal %#v but got %#v` , expected , * value )
358460 }
461+
462+ reader = NewReader (testStruct {})
463+
464+ value = reader .GetField ("PointerFloat" ).PointerFloat64 ()
465+
466+ if value != nil {
467+ t .Errorf (`TestFieldImpl_PointerFloat64 - expected field "PointerFloat" to be nil but got %#v` , * value )
468+ }
359469}
360470
361471func TestFieldImpl_Float64 (t * testing.T ) {
@@ -384,6 +494,14 @@ func TestFieldImpl_PointerString(t *testing.T) {
384494 if * value != expected {
385495 t .Errorf (`TestFieldImpl_PointerString - expected field "PointerString" to be equal %#v but got %#v` , expected , * value )
386496 }
497+
498+ reader = NewReader (testStruct {})
499+
500+ value = reader .GetField ("PointerString" ).PointerString ()
501+
502+ if value != nil {
503+ t .Errorf (`TestFieldImpl_PointerString - expected field "PointerString" to be nil but got %#v` , * value )
504+ }
387505}
388506
389507func TestFieldImpl_String (t * testing.T ) {
@@ -412,6 +530,14 @@ func TestFieldImpl_PointerBool(t *testing.T) {
412530 if * value != expected {
413531 t .Errorf (`TestFieldImpl_PointerBool - expected field "PointerBool" to be equal %#v but got %#v` , expected , * value )
414532 }
533+
534+ reader = NewReader (testStruct {})
535+
536+ value = reader .GetField ("PointerBool" ).PointerBool ()
537+
538+ if value != nil {
539+ t .Errorf (`TestFieldImpl_PointerBool - expected field "PointerBool" to be nil but got %#v` , * value )
540+ }
415541}
416542
417543func TestFieldImpl_Bool (t * testing.T ) {
@@ -440,6 +566,14 @@ func TestFieldImpl_PointerTime(t *testing.T) {
440566 if * value != expected {
441567 t .Errorf (`TestFieldImpl_PointerTime - expected field "PointerTime" to be equal %#v but got %#v` , expected , * value )
442568 }
569+
570+ reader = NewReader (testStruct {})
571+
572+ value = reader .GetField ("PointerTime" ).PointerTime ()
573+
574+ if value != nil {
575+ t .Errorf (`TestFieldImpl_PointerTime - expected field "PointerTime" to be nil but got %#v` , * value )
576+ }
443577}
444578
445579func TestFieldImpl_Time (t * testing.T ) {
@@ -454,6 +588,13 @@ func TestFieldImpl_Time(t *testing.T) {
454588 if value != expected {
455589 t .Errorf (`TestFieldImpl_Time - expected field "Time" to be equal %#v but got %#v` , expected , value )
456590 }
591+
592+ defer func () {
593+ if r := recover (); r == nil {
594+ t .Errorf ("TestFieldImpl_Time - expected panic by casting int to instance of time.Time{}" )
595+ }
596+ }()
597+ value = reader .GetField ("Integer" ).Time ()
457598}
458599
459600func TestFieldImpl_Interface (t * testing.T ) {
0 commit comments