diff --git a/dumper.go b/dumper.go index 4888ea4..c8650a2 100644 --- a/dumper.go +++ b/dumper.go @@ -11,6 +11,7 @@ type pointer struct { pos int tagged bool } + type dumper struct { buf []byte theme theme @@ -58,7 +59,9 @@ func (d *dumper) dump(v any, ignore_depth ...bool) { d.write(d.theme.Number.apply(v.(string))) case reflect.Invalid: d.write(d.theme.Nil.apply("nil")) - + case reflect.Uintptr: + v = fmt.Sprint(reflect.ValueOf(v).Uint()) + d.write(d.theme.Number.apply(v.(string))) } } diff --git a/dumper_test.go b/dumper_test.go index 1cf1d02..0c2cce6 100644 --- a/dumper_test.go +++ b/dumper_test.go @@ -577,8 +577,8 @@ func TestDumperWithComplexDataStructure(t *testing.T) { for i, line := range e_lines { if len(line) != len(r_lines[i]) { t.Fatalf(`mismatche at line %d: -- "%s" -+ "%s"`, i, line, r_lines[i]) +--- "%s" ++++ "%s"`, i+1, line, r_lines[i]) } for j, ch := range line { diff --git a/testdata/output.txt b/testdata/output.txt index 229bec6..401734a 100644 --- a/testdata/output.txt +++ b/testdata/output.txt @@ -9,7 +9,7 @@ Uint16Field: 300, Uint32Field: 400, Uint64Field: 500, - UintptrField: , + UintptrField: 600, Float32Field: 123.45600128173828, Float64Field: 789.012, Complex64Field: (1+2i), @@ -28,7 +28,7 @@ Uint16Field: 1300, Uint32Field: 1400, Uint64Field: 1500, - UintptrField: , + UintptrField: 1600, Float32Field: 223.45599365234375, Float64Field: 1789.012, Complex64Field: (2+3i), @@ -109,7 +109,7 @@ Uint16Field: 2300, Uint32Field: 2400, Uint64Field: 2500, - UintptrField: , + UintptrField: 2600, Float32Field: 323.45599365234375, Float64Field: 2789.012, Complex64Field: (3+4i), @@ -211,7 +211,7 @@ Uint16Field: 3300, Uint32Field: 3400, Uint64Field: 3500, - UintptrField: , + UintptrField: 3600, Float32Field: 423.45599365234375, Float64Field: 3789.012, Complex64Field: (4+5i), @@ -230,7 +230,7 @@ Uint16Field: 4300, Uint32Field: 4400, Uint64Field: 4500, - UintptrField: , + UintptrField: 4600, Float32Field: 523.4559936523438, Float64Field: 4789.012, Complex64Field: (5+6i), @@ -299,7 +299,7 @@ Uint16Field: 5300, Uint32Field: 5400, Uint64Field: 5500, - UintptrField: , + UintptrField: 5600, Float32Field: 623.4559936523438, Float64Field: 5789.012, Complex64Field: (6+7i), @@ -318,7 +318,7 @@ Uint16Field: 6300, Uint32Field: 6400, Uint64Field: 6500, - UintptrField: , + UintptrField: 6600, Float32Field: 723.4559936523438, Float64Field: 6789.012, Complex64Field: (7+8i),