Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(debug): enhance List function and update integration tests for f…
…ield names
  • Loading branch information
UrielOfir committed Sep 13, 2025
commit 659c8561bb6c512d9e9b5e4e3306cadcaecf605e
2 changes: 2 additions & 0 deletions tpl/debug/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,10 @@ func (ns *Namespace) VisualizeSpaces(val any) string {
// List returns a string slice of field names and methods for structs/pointers,
// or keys for maps. This function uses reflection and is non-recursive.
// For structs and pointers to structs, it returns all exported field names and method names.
// Note: Method names are collected using reflect.PointerTo(t), which includes both value and pointer receiver methods.
// For maps, it returns all keys converted to strings.
// For other types, it returns an empty slice.
func (ns *Namespace) List(val any) []string {
func (ns *Namespace) List(val any) []string {
if val == nil {
return []string{}
Expand Down
2 changes: 2 additions & 0 deletions tpl/debug/debug_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ Slice: {{ debug.List (slice 1 2 3) }}

// Test that page struct returns field names and methods (should include common page fields)
b.AssertFileContent("public/index.html", "Page Fields:")
b.AssertFileContent("public/index.html", "Title")
b.AssertFileContent("public/index.html", "Content")

// Test edge cases
b.AssertFileContent("public/index.html", "Nil: []")
Expand Down