MCPcopy Create free account
hub / github.com/github/gh-aw / TestRenderSlice_PointerToStructsAsTable

Function TestRenderSlice_PointerToStructsAsTable

pkg/console/render_slice_test.go:171–193  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

169}
170
171func 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
195func TestRenderSlice_DoublePointerToStructsAsTable(t *testing.T) {
196 var output strings.Builder

Callers

nothing calls this directly

Calls 4

renderSliceFunction · 0.85
StringMethod · 0.45
ErrorfMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected