package ecma-regex
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=490218bd6293e9ac3853d8752a31f49b
sha512=7e2e32c42d5e61a95c2f03bff830e08f260e7bcb40076b2092aab3de2afca3e197dfedaa6fc1b7f2b2b46defd458ebc5edf1d60eb2dea04493ec1c371c63e6d2
doc/TEST_EVIDENCE_AUDIT.html
Test Evidence Audit
This document summarizes what the committed tests and evidence runners prove for ecma-regex.
It is downstream of:
The test matrix maps requirement families to evidence. This audit explains the evidence layers, their default-vs-explicit role, and the remaining quality-hardening work that must not be mistaken for credited conformance.
Test Runner Tiers
The package-safe default test gate is:
opam exec -- dune runtestIt is intentionally self-contained so opam --with-test can run from a clean source archive without cache/ or external/ working artifacts. That suite includes:
- public API smoke and contract tests;
- raw UTF-16 escape matrix tests;
- raw UTF-16 negative-position tests;
- raw UTF-16 result-slicing tests.
The full local evidence gate is:
opam exec -- dune build @runtest @test/evidenceIt additionally runs ECMA-262 exact-plan tests, matcher and adapter evidence tests, generated UCD 16.0.0 tests, JSON Schema regex-facing corpus tests, test262-derived executable corpus tests, and coverage ledger/worklist invariant tests. This gate requires prepared cache/ outputs and downloaded external/ corpora and is therefore not part of opam package @runtest.
Default dune runtest is the installable package health gate. It is not, by itself, the whole conformance argument; the conformance argument also depends on the explicit evidence gate and generated ledger/corpus evidence described below.
Explicit Evidence Runners
These runners are evidence generators or evidence checkers. They are separate from ordinary unit-test intent because they construct or verify requirement coverage data.
Evidence runner | Role | Credited result |
|---|---|---|
| top-level ECMA-262 RegExp requirement ledger gate |
|
| checks committed test view of ledger invariants | coverage ledger invariants green |
| checks no remaining requirement-to-test worklist pressure |
|
| checks no selector gap backlog remains | selector gap rows are zero |
| checks exactness credit and open exactness classification |
|
| checks executable test262-derived evidence inventory |
|
| checks generated UCD 16.0.0 cases |
|
| checks raw UTF-16 inventory classification |
|
| checks generated raw UTF-16 behavior cases |
|
| checks regex-facing JSON Schema consumer corpus |
|
The ledger is the only layer that may summarize ECMA-262 requirement coverage as complete. Individual tests prove behavior; the ledger decides whether those tests are sufficient requirement-level credit.
ECMA-262 Evidence
Current ECMA-262 coverage result:
ecma262_snapshot=2026
ledger_rows=2020
direct_requirement_rows=2018
covered_rows=1770
non_applicable_rows=248
coverage_complete=trueCredited ECMA-262 evidence comes from:
- local exact compile/parser tests;
- reused-candidate exact compile/parser tests;
- compile/parser exact-plan tests;
- literal lexer exact-plan tests;
- match-engine exact-plan tests;
- exec-result exact-plan tests;
- spec-model and match-state exact tests;
- product adapter tests;
- UCD-generated tests where ECMA-262 depends on Unicode data.
The exactness audit reports:
exactness_credit_rows=1144
open_exactness_rows=410
potential_exact_ready_rows=0The 410 open exactness rows are the executable negative syntax corpus rows. They are deliberately not counted as ECMA-262 requirement credit until each row is mapped to a concrete requirement row or proved to duplicate an already credited requirement.
Product Adapter Evidence
Product adapter evidence covers ECMA-262 RegExp behavior exposed through direct OCaml functions instead of JavaScript object/prototype dispatch.
Credited adapter rows:
search_adapter=16
match_adapter=25
match_all_adapter=16
split_adapter=52
replace_adapter=119
escape_adapter=32Evidence artifacts:
test/test_ecma262_search_adapter.mltest/test_ecma262_match_adapter.mltest/test_ecma262_match_all_adapter.mltest/test_ecma262_split_adapter.mltest/test_ecma262_replace_adapter.mltest/test_ecma262_escape_adapter.ml
These tests prove the explicit OCaml adapter API. They do not claim JavaScript object dispatch, prototype lookup, constructors, receiver coercion, or JavaScript callable replacement-function behavior.
Unicode Evidence
Unicode behavior is pinned to UCD 16.0.0.
Required Unicode source files:
PropertyAliases.txtPropertyValueAliases.txtUnicodeData.txtCaseFolding.txtPropList.txtDerivedCoreProperties.txtDerivedNormalizationProps.txtScripts.txtScriptExtensions.txtemoji/emoji-data.txt
Generated runtime source:
lib/ecma_regex_ucd_tables.ml
Generation and test tools:
tools/build_ucd_tables.pytools/build_ucd_regexp_tests.pytest/test_ecma262_ucd_generated_cases.ml
Current credited result:
ucd_version=16.0.0
ucd_generated_case_rows=366
ucd_coverage_credit_rows=366
ucd_alcotest_cases=17This evidence covers Unicode property aliases, property value aliases, Script/Script_Extensions membership, General_Category membership, binary properties, property escapes inside character classes, character-set membership, and simple/common case folding used by Unicode ignore-case matching.
Changing the Unicode version is a semantic change: the generator, runtime tables, UCD evidence, and conformance ledger must all be regenerated and rechecked together.
Raw UTF-16 Evidence
Raw UTF-16 evidence proves explicit ECMAScript String behavior where OCaml UTF-8 strings are not sufficient to observe the semantics.
Public surfaces covered:
js_stringjs_string_of_utf8js_string_of_utf16_code_unitsjs_string_to_utf16_code_unitsexec_jssearch_jssearch_index_jsexec_instance_jsiter_matches_jsnext_match_js- JS variants of match, matchAll, split, replace, replaceAll, and escape
Current raw UTF-16 inventory:
rows=35
covered=32
open=0
non_applicable_with_reason=3
generated_cases=1625Evidence artifacts:
test/test_raw_utf16_coverage_matrix.mltest/test_raw_utf16_generated_cases.mltest/test_raw_utf16_result_slicing_matrix.mltest/test_raw_utf16_negative_position_matrix.mltest/test_raw_utf16_escape_matrix.mltest/test_api.ml
This evidence covers lone surrogates, valid surrogate pairs, Unicode code-point advancement, non-Unicode code-unit behavior, raw result slicing, captures over raw strings, iterator advancement, adapter variants, and RegExp.escape behavior over raw ECMAScript Strings.
JSON Schema Consumer Evidence
JSON Schema is a consumer profile, not the governing regular-expression language source.
Covered JSON Schema regex-facing surfaces:
patternpatternPropertiesformat: regex
Covered draft families:
- draft-03
- draft-04
- draft-06
- draft-07
- draft-2019-09
- draft-2020-12
- v1 corpus layout
Current corpus result:
corpus_cases=187
observed_pass=187
observed_fail=0
remaining_failure_worklist_rows=0The corpus proves that regex-facing JSON Schema consumer behavior is compatible with the ecma-regex public API. It does not define a separate regexp language and does not override ECMA-262 RegExp semantics.
Contract-Only Evidence
The following are public OCaml contract rather than direct ECMA-262 requirements:
- OCaml type names;
- record and variant field names;
syntax_error = string;- use of
result,option, andlist; - direct functions instead of JavaScript method dispatch;
- eager result materialization instead of JavaScript iterator objects.
Contract-only does not mean untested. Contract-only behavior is checked through the public signature and API tests, but its source of truth is the documented OCaml API rather than one-to-one JavaScript host object text.
Intentional Exclusions
Intentional exclusions are visible in the product-surface matrix and are not counted as matcher gaps.
Current exclusion family:
- JavaScript runtime embedding;
- JavaScript object/prototype dispatch;
- constructors and subclassing;
- prototype mutation;
- dynamic method lookup;
- receiver coercion and object wrapping;
- function objects and function metadata;
- JavaScript callable replacement functions;
- plain String prototype branches;
- Annex B mutating
RegExp.prototype.compilehost behavior.
Where these areas have RegExp semantic equivalents, the semantic equivalent is tested through explicit OCaml adapter functions.
Package And Documentation Evidence
Package/install evidence is not ECMA-262 conformance evidence, but it proves the delivered package surface.
Current package gates:
opam lint ecma-regex.opamopam exec -- dune build @installopam install . --with-test --dry-run --yesopam exec -- dune build @docin a switch withodocavailableopam install . --with-test --with-doc --dry-run --yesin a switch where the documentation dependency can be solved
These gates prove metadata sanity, install artifact construction, documentation buildability in an odoc-capable switch, and opam solver/package dry-run behavior. They do not add ECMA-262 semantic coverage credit.
Quality-Hardening Follow-Up
Current follow-up:
negative_syntax_executable_rows=410
negative_syntax_requirement_linked_rows=0
negative_syntax_coverage_credit_rows=0This is not a known runtime mismatch. It is a stricter evidence-accounting task: map executable negative syntax corpus rows to exact ECMA-262 requirement rows, or prove that a row duplicates already credited syntax evidence.
Until that mapping exists, those rows remain uncredited evidence, not conformance credit.