Skip to content

[java] Unit test the BiDi code generator #18128

Closed

Description

@titusfortner

BiDiGenerator (#17777) has no tests of its own. Its coverage is indirect: a generator branch is exercised only when one of the generated types that happens to use it has a per-type test. That is how the integer-valued enum (emulation.MediaFeaturesGrid), the inline-union NumberValue.value check, null list elements in serializeExpr, the scalar-union path (input.Origin), and the empty NodeProperties.Attributes class (#18106) all shipped untested.

Add a BiDiGeneratorTest modelled on the Python generator tests in #18052: feed small inline schema nodes to the generator's emit functions and assert on the emitted source, one test per branch. Use real schema fragments as the oracle rather than mocks. Start with the cases above, then cover record, enum, union, alias, list and map emission, required/optional/nullable fields, const handling, and extensible records.

Ruby already tests its CDP generator (cdp_client_generator_spec.rb); Python is adding BiDi generator tests in #18052. Java should not be the one binding whose generator is untested.

Follow-up to #17777.

Activity

  1. added
    C-java
    I-enhancement
    on Oct 6, 2026
  2. nvborisenko commented on Oct 8, 2026

    @nvborisenko
    Member

    IMHO it is easier to use generated stuff, instead of covering generator..

  3. tanaysiabobette26 commented on Oct 10, 2026

    @tanaysiabobette26

    Having worked on the Python generator tests in #18052, relying only on generated classes is how edge cases like null list elements in serializeExpr slipped through unnoticed. Feeding small inline schema fragments directly to BiDiGenerator makes it much faster to pinpoint generator branch logic without needing to compile the full generated binding suite.

  4. added a commit that references this issue on Oct 16, 2026
    46cfab1
  5. github-actions commented on Nov 21, 2026

    @github-actions
    Contributor

    This issue has been automatically locked since there has not been any recent activity since it was closed. Please open a new issue for related bugs.

  6. locked and limited conversation to collaborators on Nov 21, 2026
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

    C-javaI-enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions