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

Function TestFormatFieldValue

pkg/console/render_test.go:201–221  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

199}
200
201func TestFormatFieldValue(t *testing.T) {
202 tests := []struct {
203 name string
204 value any
205 expected string
206 }{
207 {"integer", 42, "42"},
208 {"string", "hello", "hello"},
209 {"empty string", "", "-"},
210 {"float", 3.14, "3.14"},
211 {"nil pointer", (*int)(nil), "-"},
212 }
213
214 for _, tt := range tests {
215 t.Run(tt.name, func(t *testing.T) {
216 val := reflect.ValueOf(tt.value)
217 result := formatFieldValue(val)
218 assert.Equal(t, tt.expected, result, "formatted field value should match expectation")
219 })
220 }
221}
222
223func TestRenderStruct_ComplexExample(t *testing.T) {
224 // Test a more complex nested structure

Callers

nothing calls this directly

Calls 2

formatFieldValueFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected