(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestFormatFieldValue_Pointers(t *testing.T) { |
| 12 | tests := []struct { |
| 13 | name string |
| 14 | value any |
| 15 | expected string |
| 16 | }{ |
| 17 | { |
| 18 | name: "nil pointer", |
| 19 | value: (*int)(nil), |
| 20 | expected: "-", |
| 21 | }, |
| 22 | { |
| 23 | name: "single pointer to int", |
| 24 | value: func() *int { |
| 25 | v := 42 |
| 26 | return &v |
| 27 | }(), |
| 28 | expected: "42", |
| 29 | }, |
| 30 | { |
| 31 | name: "double pointer to int", |
| 32 | value: func() **int { |
| 33 | v := 42 |
| 34 | p1 := &v |
| 35 | return &p1 |
| 36 | }(), |
| 37 | expected: "42", |
| 38 | }, |
| 39 | } |
| 40 | |
| 41 | for _, tt := range tests { |
| 42 | t.Run(tt.name, func(t *testing.T) { |
| 43 | val := reflect.ValueOf(tt.value) |
| 44 | result := formatFieldValue(val) |
| 45 | if result != tt.expected { |
| 46 | t.Errorf("got %q, want %q", result, tt.expected) |
| 47 | } |
| 48 | }) |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | func TestFormatFieldValue_NumericTypes(t *testing.T) { |
| 53 | tests := []struct { |
nothing calls this directly
no test coverage detected