diff --git a/conformance/README.md b/conformance/README.md new file mode 100644 index 0000000..173cc90 --- /dev/null +++ b/conformance/README.md @@ -0,0 +1,23 @@ +# Conformance cases + +Portable cases grouped by the compiler phase they exercise. Each case is a directory holding a +`case.json` (see `schemas/case.schema.json`) and one `.medui` fixture. `tools/validate.py` checks +their structure; an implementation runs them and compares observable behaviour. + +A rejection case pins a full position — `line` and `column`, 1-based, columns in UTF-8 bytes. The +pinned position points at **the token that carries the violation**, and every consumer reproduces +it as far as its declared `positions` precision goes (`spec/diagnostics.md`). + +## Registered-code coverage + +Every registered `MEDUI-E###` should have at least one case once it is mechanically expressible. +Codes still without one, and why: + +| Code | Meaning | Blocked on | +|---|---|---| +| `MEDUI-E000`–`MEDUI-E003` | recipe / source I/O failures | a fixture convention for a broken or missing recipe file alongside the `.medui` source | +| `MEDUI-E016` | forbidden construct | a grammar-level statement of what a "forbidden construct" is versus an unexpected token (`MEDUI-E010`) | +| `MEDUI-E050` | text budget exceeded | a font / text-measurement model; the contract has none yet | +| `MEDUI-E053` | dynamic text escapes its charset | a charset model and charset-package `inputs`, the same gap that leaves `charset` resolution uncoded | + +Adding any of these is a contract change (a case defines an outcome), not a drop-in fixture. diff --git a/conformance/layout/positioned-node-overflow/case.json b/conformance/layout/positioned-node-overflow/case.json new file mode 100644 index 0000000..2fb168c --- /dev/null +++ b/conformance/layout/positioned-node-overflow/case.json @@ -0,0 +1,9 @@ +{ + "id": "MEDUI-CASE-LAYOUT-POSITIONED-NODE-OVERFLOW", + "phase": "layout", + "source": "source.medui", + "expected": { + "valid": false, + "diagnostics": [{ "code": "MEDUI-E051", "line": 8, "column": 9 }] + } +} diff --git a/conformance/layout/positioned-node-overflow/source.medui b/conformance/layout/positioned-node-overflow/source.medui new file mode 100644 index 0000000..ff54323 --- /dev/null +++ b/conformance/layout/positioned-node-overflow/source.medui @@ -0,0 +1,12 @@ +Screen PositionedNodeOverflow { + layout: Vertical { spacing: 0px; padding: 0px; } + surface: 200px, 200px; + Label { + id: edge; + width: 100px; + height: 40px; + position: 150px, 0px; + text: t("STR-EDGE"); + color: Theme.Colors.Title; + } +} diff --git a/conformance/layout/surface-exceeded/case.json b/conformance/layout/surface-exceeded/case.json new file mode 100644 index 0000000..c7c675e --- /dev/null +++ b/conformance/layout/surface-exceeded/case.json @@ -0,0 +1,9 @@ +{ + "id": "MEDUI-CASE-LAYOUT-SURFACE-EXCEEDED", + "phase": "layout", + "source": "source.medui", + "expected": { + "valid": false, + "diagnostics": [{ "code": "MEDUI-E052", "line": 6, "column": 16 }] + } +} diff --git a/conformance/layout/surface-exceeded/source.medui b/conformance/layout/surface-exceeded/source.medui new file mode 100644 index 0000000..15c4323 --- /dev/null +++ b/conformance/layout/surface-exceeded/source.medui @@ -0,0 +1,11 @@ +Screen SurfaceExceeded { + layout: Vertical { spacing: 0px; padding: 0px; } + surface: 100px, 100px; + Label { + id: banner; + width: 200px; + height: 24px; + text: t("STR-TITLE"); + color: Theme.Colors.Title; + } +} diff --git a/conformance/safety/unknown-cv-check/case.json b/conformance/safety/unknown-cv-check/case.json new file mode 100644 index 0000000..7450eb0 --- /dev/null +++ b/conformance/safety/unknown-cv-check/case.json @@ -0,0 +1,9 @@ +{ + "id": "MEDUI-CASE-SAFETY-UNKNOWN-CV-CHECK", + "phase": "safety", + "source": "source.medui", + "expected": { + "valid": false, + "diagnostics": [{ "code": "MEDUI-E071", "line": 3, "column": 33 }] + } +} diff --git a/conformance/safety/unknown-cv-check/source.medui b/conformance/safety/unknown-cv-check/source.medui new file mode 100644 index 0000000..05e5ad4 --- /dev/null +++ b/conformance/safety/unknown-cv-check/source.medui @@ -0,0 +1,13 @@ +Screen UnknownCvCheck { + layout: Vertical { spacing: 0px; padding: 0px; } + @safety_critical(cv_check: [Bogus]) + Button { + id: action; + width: 100px; + height: 40px; + label: t("STR-ACTION"); + color: Theme.Colors.PrimaryAction; + source: "ACTION"; + requirement: "REQ-UCC-001"; + } +} diff --git a/conformance/syntax/duplicate-node-id/case.json b/conformance/syntax/duplicate-node-id/case.json new file mode 100644 index 0000000..53d0fa9 --- /dev/null +++ b/conformance/syntax/duplicate-node-id/case.json @@ -0,0 +1,9 @@ +{ + "id": "MEDUI-CASE-SYNTAX-DUPLICATE-NODE-ID", + "phase": "syntax", + "source": "source.medui", + "expected": { + "valid": false, + "diagnostics": [{ "code": "MEDUI-E014", "line": 11, "column": 13 }] + } +} diff --git a/conformance/syntax/duplicate-node-id/source.medui b/conformance/syntax/duplicate-node-id/source.medui new file mode 100644 index 0000000..edffdfc --- /dev/null +++ b/conformance/syntax/duplicate-node-id/source.medui @@ -0,0 +1,17 @@ +Screen DuplicateNodeId { + layout: Vertical { spacing: 0px; padding: 0px; } + Label { + id: title; + width: 100px; + height: 24px; + text: t("STR-TITLE"); + color: Theme.Colors.Title; + } + Label { + id: title; + width: 100px; + height: 24px; + text: t("STR-SUBTITLE"); + color: Theme.Colors.Title; + } +} diff --git a/conformance/syntax/source-not-utf8/case.json b/conformance/syntax/source-not-utf8/case.json new file mode 100644 index 0000000..a182902 --- /dev/null +++ b/conformance/syntax/source-not-utf8/case.json @@ -0,0 +1,9 @@ +{ + "id": "MEDUI-CASE-SYNTAX-SOURCE-NOT-UTF8", + "phase": "syntax", + "source": "source.medui", + "expected": { + "valid": false, + "diagnostics": [{ "code": "MEDUI-E004", "line": 1, "column": 8 }] + } +} diff --git a/conformance/syntax/source-not-utf8/source.medui b/conformance/syntax/source-not-utf8/source.medui new file mode 100644 index 0000000..f40e4e5 --- /dev/null +++ b/conformance/syntax/source-not-utf8/source.medui @@ -0,0 +1,2 @@ +Screen ÿþ { +} diff --git a/conformance/syntax/unexpected-token/case.json b/conformance/syntax/unexpected-token/case.json new file mode 100644 index 0000000..52abcec --- /dev/null +++ b/conformance/syntax/unexpected-token/case.json @@ -0,0 +1,9 @@ +{ + "id": "MEDUI-CASE-SYNTAX-UNEXPECTED-TOKEN", + "phase": "syntax", + "source": "source.medui", + "expected": { + "valid": false, + "diagnostics": [{ "code": "MEDUI-E010", "line": 5, "column": 22 }] + } +} diff --git a/conformance/syntax/unexpected-token/source.medui b/conformance/syntax/unexpected-token/source.medui new file mode 100644 index 0000000..f34b4ca --- /dev/null +++ b/conformance/syntax/unexpected-token/source.medui @@ -0,0 +1,10 @@ +Screen UnexpectedToken { + layout: Vertical { spacing: 0px; padding: 0px; } + Label { + id: title; + width: 100px 100px; + height: 24px; + text: t("STR-TITLE"); + color: Theme.Colors.Title; + } +}