Skip to content

autodoc: decltests for files-as-a-struct don't show up #23614

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
squeek502 opened this issue Apr 19, 2025 · 1 comment · May be fixed by #23615
Open

autodoc: decltests for files-as-a-struct don't show up #23614

squeek502 opened this issue Apr 19, 2025 · 1 comment · May be fixed by #23615
Labels
autodoc The web application for interactive documentation and generation of its assets. bug Observed behavior contradicts documented or intended behavior

Comments

@squeek502
Copy link
Collaborator

Example:

test FixedBufferAllocator {

doesn't show up in the FixedBufferAllocator docs:

https://ziglang.org/documentation/0.14.0/std/#std.heap.FixedBufferAllocator

@squeek502 squeek502 added autodoc The web application for interactive documentation and generation of its assets. bug Observed behavior contradicts documented or intended behavior labels Apr 19, 2025
@squeek502
Copy link
Collaborator Author

squeek502 commented Apr 19, 2025

Looking into it a little bit, I think there are two problems:

  1. renderNamespacePage in main.js does not call renderDocTests
  2. w.file.get().doctests does not get the doctest added, that only happens for function names

The first one is easy to fix, unsure how to go about fixing the second, since I'm not sure what name to lookup to find the associated doctest.

EDIT: One potential fix using the stem of the filename submitted here: #23615

squeek502 added a commit to squeek502/zig that referenced this issue Apr 20, 2025
This is not a perfect solution and relies on the convention that file-as-a-struct types have the same file name as the type name. Fixes ziglang#23614
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autodoc The web application for interactive documentation and generation of its assets. bug Observed behavior contradicts documented or intended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant