(t *testing.T)
| 169 | } |
| 170 | |
| 171 | func TestRenderSlice_PointerToStructsAsTable(t *testing.T) { |
| 172 | var output strings.Builder |
| 173 | data := []*SliceTestStruct{ |
| 174 | {ID: 10, Name: "alpha"}, |
| 175 | {ID: 20, Name: "beta"}, |
| 176 | } |
| 177 | val := reflect.ValueOf(data) |
| 178 | |
| 179 | renderSlice(val, "Pointer Table", &output, 0) |
| 180 | |
| 181 | result := output.String() |
| 182 | |
| 183 | // Should still render as table even though elements are pointers |
| 184 | if !strings.Contains(result, "# Pointer Table") { |
| 185 | t.Errorf("Output should contain title, got: %q", result) |
| 186 | } |
| 187 | if !strings.Contains(result, "ID") { |
| 188 | t.Error("Output should contain ID column header") |
| 189 | } |
| 190 | if !strings.Contains(result, "alpha") { |
| 191 | t.Error("Output should contain data from pointer elements") |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | func TestRenderSlice_DoublePointerToStructsAsTable(t *testing.T) { |
| 196 | var output strings.Builder |
nothing calls this directly
no test coverage detected