Skip to content

Implement skipped test: test/spec/spec_ss18_6_unreachable_todo_assert_matches.w #283

Closed

Description

@ehartford

Skipped test: test/spec/spec_ss18_6_unreachable_todo_assert_matches.w

Skip reason: non-executable spec sketch for Section 18.6 — Unreachable, Todo, Assert_matches (formerly 25.49); contains pseudo-code for unimplemented feature work

Implementation is required. This issue tracks replacing the skipped test with executable coverage and removing the //! skip: directive.

Acceptance criteria:

  • Implement the compiler/runtime/stdlib behavior required by this test, or split the spec sketch into concrete executable positive/negative tests.
  • Remove the //! skip: directive from test/spec/spec_ss18_6_unreachable_todo_assert_matches.w.
  • The test runs under make test and is not counted as skipped.

Activity

  1. ehartford commented on May 30, 2026

    @ehartford
    ContributorAuthor

    Current scope (from work on #282):

    • unreachable() — works.
    • todo("...") — works (compiles; panics at runtime).
    • assert_matches(value, pattern) — not implemented (undefined variable). This needs a pattern-taking builtin (parser + Sema + lowering to a match + panic with the value's Debug repr), not a stdlib function, since the second argument is a pattern.
    • assert_eq / assert_ne — no generic versions exist; only type-suffixed helpers (assert_eq_i32, assert_eq_str, …) in lib/test/testing.w. The sketch uses the generic forms, so generic assert_eq/assert_ne (which print both values on failure, requiring Debug formatting) are still needed.

    So the remaining work here is assert_matches + generic assert_eq/assert_ne.

  2. ehartford commented on May 30, 2026

    @ehartford
    ContributorAuthor

    Design addition (maintainer): regex form of assert_matches

    In addition to structural pattern matching (assert_matches(value, Err(_))), assert_matches should support a regex string-matching form backed by the PCRE2 regex runtime (the migrated std.re.pcre2_* / rt/regex_runtime.w with_regex_* surface) — i.e. assert that a string matches a regex pattern.

    Implications:

    Remaining for this issue overall: structural assert_matches, the new regex assert_matches form, and generic assert_eq/assert_ne (the sketch uses the generic forms; only type-suffixed helpers exist today in lib/test/testing.w). unreachable() and todo() already work.

  3. ehartford commented on May 30, 2026

    @ehartford
    ContributorAuthor

    Completed in commits 01aa1fd (assert_eq/assert_ne) and 1d22240 (assert_matches) on local main, pending push.

    • assert_eq / assert_ne: generic prelude assertions over Eq + Debug, showing both values on failure.
    • assert_matches(value, pattern): special-cased in the parser and desugared to match value { pattern => (), _ => assert_matches_failed() }, reusing existing match infrastructure (no new AST/Sema/MIR).
    • unreachable() / todo() already worked.

    The skipped sketch test/spec/spec_ss18_6_unreachable_todo_assert_matches.w is now executable (5 tests), skip removed.

    Note: the spec's nested example uses .Db(.NotFound(..)); the .. rest pattern in tuple variants is a separate pre-existing pattern-parser limitation, filed as #305 (explicit _, _ wildcards used meanwhile).

    Verified: build + fixpoint + full test suite green.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions