Skip to content

test: add Go unit tests for the codegen, idnaref, and ucd packages #21

Description

@OmarAlJarrah

The Go code under tools/ has no tests — go test ./... reports "no test files" for every package. These packages are load-bearing:

  • tools/internal/codegen emits the committed Kotlin lookup tables and conformance fixtures.
  • tools/internal/ucd parses the Unicode Character Database.
  • tools/internal/idnaref is the reference implementation whose output derives the IDNA known-failures baseline that the Kotlin conformance suite ratchets against.

A bug in any of them can silently corrupt generated data or the derived baseline. Add Go unit tests, for example:

  • ucd: parsing of code-point ranges and First/Last blocks, hex-scalar fields, and the merged mapping / validity / NFC / Bidi tables over small fixtures.
  • idnaref: targeted ToASCII cases (mapping, NFC, Punycode round-trips, ContextJ, CheckBidi, decoded-A-label re-validation), plus spot-checks that its verdicts match the Kotlin runtime's expected behaviour.
  • codegen: the chunking / escaping helpers, the JSON lone-surrogate decoder, and byte-stable output from each generator.

Wire go test ./... into the contributor workflow (and into CI once it exists).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions