Skip to content

Replace Buffer length-only tests with real round-trip verification (Phase 5+) #15

Description

@hasanzakeri

tests/test_buffer.py::TestCreation currently only asserts len(buf) after add_str / add because the Buffer has no way to read codepoints back out. Once Font.shape() lands (Phase 4→5), known-input strings shaped against a known-input font should produce a deterministic glyph run — that's the real regression signal, not the codepoint count.

What to do when Phase 5 is in:

  • For a couple of representative inputs (ASCII, Arabic, astral plane, empty), shape against a bundled font and assert the full serialize() output.
  • Delete the length-only tests whose coverage is now subsumed (test_add_str_ascii, test_add_str_multi_bmp, test_add_str_astral, test_add_str_multiple_calls_append), or keep one as a quick smoke test.
  • Keep test_add_codepoint (exercises the add(codepoint, cluster) path specifically) but extend it to verify the cluster values survive shaping.

Why it matters: right now we're only proving that push_str doesn't drop characters. We're not proving that text actually reaches the shaper correctly — a bug that silently corrupted buffer contents would slip through these tests.

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions