Skip to content

ctest: Figure out a way to test private items #4649

Open

Description

@tgross35

We have some definitions that aren't crate-public but come from C, so we should probably test them. One idea about how to do this is to just paste private items into the output file, since we have the AST version available.

Mentioned at #4610 (comment)

Activity

  1. mbyx commented on Aug 13, 2025

    @mbyx
    Contributor

    Would it be possible to just walk the entire crate and make everything public by modifying the AST, then just testing the new version? Kind of like what src-hotfix does right now by replacing the ::.

    Or if we only want to test private items separately then a simple inversion, to make private items public and public items private, and for private fields making sure the item remains public as well as marking the field public.

  2. tgross35 commented on Aug 13, 2025

    @tgross35
    MemberAuthor

    Sure, that would work too as long as the glob imports were removed (since private items within modules may have the same name). It would be nice to only copy the items we need rather than the entire source, though.

  3. xtqqczze commented on Sep 16, 2026

    @xtqqczze
    Contributor

    The quick-and-dirty approach would be to make all of the private fields pub(crate). This is what rustix does, for example.

  4. tgross35 commented on Sep 16, 2026

    @tgross35
    MemberAuthor

    I'd be fine with that visibility change but does that help us? libc-test is a separate crate.

    We could probably make it include! or #[path = "..."] but I assume that would come with other issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ctestIssues relating to the ctest crate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions