eyelang 1.7.5 → 1.7.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/conformance-report.md +26 -0
- package/docs/guide.md +5 -2
- package/package.json +3 -2
- package/test/conformance/README.md +10 -4
- package/test/conformance/cases/strings/trim_tabs_and_spaces.eye +2 -1
- package/test/conformance/expected-proofs/proofs/bindings_nested_term.eye +16 -0
- package/test/conformance/expected-proofs/proofs/builtin_numeric.eye +16 -0
- package/test/conformance/expected-proofs/proofs/conjunction_order.eye +19 -0
- package/test/conformance/expected-proofs/proofs/iri_atom.eye +16 -0
- package/test/conformance/expected-proofs/proofs/list_builtin.eye +20 -0
- package/test/conformance/expected-proofs/proofs/once_child.eye +22 -0
- package/test/conformance/expected-proofs/proofs/rule_fact.eye +16 -0
- package/test/conformance/expected-proofs/proofs/table_recursive.eye +59 -0
- package/test/conformance/proofs/proofs/bindings_nested_term.eye +4 -0
- package/test/conformance/proofs/proofs/builtin_numeric.eye +3 -0
- package/test/conformance/proofs/proofs/conjunction_order.eye +5 -0
- package/test/conformance/proofs/proofs/iri_atom.eye +4 -0
- package/test/conformance/proofs/proofs/list_builtin.eye +3 -0
- package/test/conformance/proofs/proofs/once_child.eye +5 -0
- package/test/conformance/proofs/proofs/rule_fact.eye +4 -0
- package/test/conformance/proofs/proofs/table_recursive.eye +7 -0
- package/test/run-conformance-report.mjs +19 -7
- package/test/run-conformance.mjs +29 -0
- package/test/run-regression.mjs +11 -1
package/README.md
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Conformance Eyelang report
|
|
2
|
+
|
|
3
|
+
This report summarizes the file-based conformance corpus under `test/conformance/`.
|
|
4
|
+
|
|
5
|
+
| Category | Positive | Errors | Warnings | Proofs | Total |
|
|
6
|
+
|---|---:|---:|---:|---:|---:|
|
|
7
|
+
| aggregation | 5 | 0 | 0 | 0 | 5 |
|
|
8
|
+
| arithmetic | 12 | 0 | 0 | 0 | 12 |
|
|
9
|
+
| atoms | 14 | 5 | 0 | 0 | 19 |
|
|
10
|
+
| builtins | 2 | 0 | 0 | 0 | 2 |
|
|
11
|
+
| context | 3 | 0 | 0 | 0 | 3 |
|
|
12
|
+
| control | 5 | 0 | 0 | 0 | 5 |
|
|
13
|
+
| declarations | 5 | 0 | 0 | 0 | 5 |
|
|
14
|
+
| legacy-numbered | 104 | 0 | 0 | 0 | 104 |
|
|
15
|
+
| lists | 18 | 1 | 0 | 0 | 19 |
|
|
16
|
+
| materialize | 2 | 0 | 0 | 0 | 2 |
|
|
17
|
+
| negation | 3 | 0 | 13 | 0 | 16 |
|
|
18
|
+
| proofs | 0 | 0 | 0 | 8 | 8 |
|
|
19
|
+
| rules | 2 | 1 | 0 | 0 | 3 |
|
|
20
|
+
| strings | 15 | 0 | 0 | 0 | 15 |
|
|
21
|
+
| syntax | 4 | 19 | 0 | 0 | 23 |
|
|
22
|
+
| table | 2 | 0 | 0 | 0 | 2 |
|
|
23
|
+
| terms | 10 | 1 | 0 | 0 | 11 |
|
|
24
|
+
| unification | 4 | 0 | 0 | 0 | 4 |
|
|
25
|
+
| variables | 8 | 8 | 0 | 0 | 16 |
|
|
26
|
+
| **Total** | **218** | **35** | **13** | **8** | **274** |
|
package/docs/guide.md
CHANGED
|
@@ -503,7 +503,9 @@ Summarize the conformance corpus by category:
|
|
|
503
503
|
npm run conformance:report
|
|
504
504
|
```
|
|
505
505
|
|
|
506
|
-
|
|
506
|
+
Release preparation runs the same report and writes [`conformance-report.md`](../conformance-report.md), so each published package carries a current conformance summary.
|
|
507
|
+
|
|
508
|
+
The conformance suite lives in [`test/conformance/`](../test/conformance/) as a file-based eyelang corpus. Positive cases pair `cases/<name>.eye` with exact expected stdout under `expected/<name>.eye`; negative cases pair `errors/<name>.eye` with exact expected error text under `expected-errors/<name>.txt`; warning cases pair `warnings/<name>.eye` with exact `--warnings` stdout and stderr files under `expected-warnings/`; proof cases pair `proofs/<name>.eye` with exact `--proof` output under `expected-proofs/`. Cases may be grouped in category directories such as `arithmetic/`, `strings/`, `lists/`, `terms/`, `atoms/`, `variables/`, `negation/`, and `syntax/`, so another implementation can reuse the same corpus as an executable language contract. The suite covers the standard language surface from the language reference, including reusable built-ins, standard errors, standard warnings, and the machine-readable `why/2` proof-output contract. The regression suite lives in [`test/run-regression.mjs`](../test/run-regression.mjs) and covers CLI regressions, the public JavaScript API, and white-box invariants for parser, unification, and indexing behavior.
|
|
507
509
|
|
|
508
510
|
## Development and release
|
|
509
511
|
|
|
@@ -531,7 +533,8 @@ For a release:
|
|
|
531
533
|
2. update `README.md` and the language reference;
|
|
532
534
|
3. regenerate golden outputs if behavior changed;
|
|
533
535
|
4. run `npm run test:eyelang`;
|
|
534
|
-
5.
|
|
536
|
+
5. run `npm run conformance:report -- conformance-report.md`;
|
|
537
|
+
6. publish the repository with the browser playground assets if publishing the playground. The playground includes controls equivalent to CLI `--stats` and `--proof`.
|
|
535
538
|
|
|
536
539
|
## Relationship to Eyeling
|
|
537
540
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eyelang",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.6",
|
|
4
4
|
"description": "A small Prolog-like logic programming language for rules, goals, answers, and proofs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
"playground.html",
|
|
31
31
|
"bin",
|
|
32
32
|
"src",
|
|
33
|
+
"conformance-report.md",
|
|
33
34
|
"docs",
|
|
34
35
|
"examples",
|
|
35
36
|
"test"
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
"test:conformance": "node test/run-conformance.mjs",
|
|
44
45
|
"test:examples": "node test/run-examples.mjs",
|
|
45
46
|
"test:regression": "node test/run-regression.mjs",
|
|
46
|
-
"preversion": "npm test",
|
|
47
|
+
"preversion": "npm test && npm run conformance:report -- conformance-report.md",
|
|
47
48
|
"postversion": "git push origin HEAD --follow-tags",
|
|
48
49
|
"conformance:report": "node test/run-conformance-report.mjs"
|
|
49
50
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
This directory contains the executable conformance cases for the Eyelang language and reference engine. The normative language description is in the [Eyelang language reference](../../../docs/language-reference.md).
|
|
4
4
|
|
|
5
|
-
The suite is intentionally file-based so another implementation can run the same programs and compare exact standard output, expected errors, and expected
|
|
5
|
+
The suite is intentionally file-based so another implementation can run the same programs and compare exact standard output, expected errors, expected warnings, and expected proof output. The conformance corpus is part of the public language contract, not just an implementation smoke test.
|
|
6
6
|
|
|
7
7
|
A normal positive case consists of:
|
|
8
8
|
|
|
@@ -20,6 +20,11 @@ Expected-warning cases consist of:
|
|
|
20
20
|
- `conformance/expected-warnings/<name>.eye` — exact expected standard output;
|
|
21
21
|
- `conformance/expected-warnings/<name>.txt` — exact expected standard error.
|
|
22
22
|
|
|
23
|
+
Expected-proof cases consist of:
|
|
24
|
+
|
|
25
|
+
- `conformance/proofs/<name>.eye` — input program run through the CLI with `--proof`;
|
|
26
|
+
- `conformance/expected-proofs/<name>.eye` — exact expected standard output, including both answer facts and `why/2` proof facts.
|
|
27
|
+
|
|
23
28
|
Case names may be nested in category directories such as `arithmetic/`, `strings/`, `lists/`, `terms/`, `atoms/`, `variables/`, `negation/`, or `syntax/`. Expected files mirror the same relative path.
|
|
24
29
|
|
|
25
30
|
## Running the suite
|
|
@@ -40,6 +45,7 @@ Summarize conformance coverage by category:
|
|
|
40
45
|
|
|
41
46
|
```sh
|
|
42
47
|
npm run conformance:report
|
|
48
|
+
npm run conformance:report -- conformance-report.md
|
|
43
49
|
```
|
|
44
50
|
|
|
45
51
|
Run matching conformance cases by passing a filename or directory fragment:
|
|
@@ -51,14 +57,14 @@ node test/run-conformance.mjs variables/
|
|
|
51
57
|
node test/run-conformance.mjs error/variables
|
|
52
58
|
```
|
|
53
59
|
|
|
54
|
-
The runner executes normal materialized programs in-process through the public JavaScript API so small conformance cases avoid measuring Node startup overhead. Warning cases intentionally use the CLI because warning output
|
|
60
|
+
The runner executes normal materialized programs in-process through the public JavaScript API so small conformance cases avoid measuring Node startup overhead. Warning and proof cases intentionally use the CLI because warning output and `why/2` proof output are host-interface contracts.
|
|
55
61
|
|
|
56
62
|
## Scope
|
|
57
63
|
|
|
58
|
-
The conformance corpus is a single eyelang suite. It covers the standard language described by the language reference: lexical syntax, facts, definite clauses, first-order terms, lists, conjunction, structured unification, left-to-right goal-directed proof search, materialized output, read-back printing, standard built-ins, declarations, warnings, errors, and standard host behavior.
|
|
64
|
+
The conformance corpus is a single eyelang suite. It covers the standard language described by the language reference: lexical syntax, facts, definite clauses, first-order terms, lists, conjunction, structured unification, left-to-right goal-directed proof search, materialized output, read-back printing, standard built-ins, declarations, warnings, errors, proof output, and standard host behavior.
|
|
59
65
|
|
|
60
66
|
The suite deliberately does not separate `core` and `extension` profiles. Reusable built-ins such as arithmetic, strings, lists, aggregation, context terms, term inspection, and search control are part of the standard eyelang conformance surface. Implementation-specific built-ins may still exist in downstream hosts, but they should have their own tests outside this corpus unless they are standardized.
|
|
61
67
|
|
|
62
68
|
## Updating expected output
|
|
63
69
|
|
|
64
|
-
There is no committed auto-accept mode. To update an expected file, run the matching case with the conformance runner, inspect the result, and replace the corresponding file under `conformance/expected/`, `conformance/expected-errors/`, or `conformance/expected-
|
|
70
|
+
There is no committed auto-accept mode. To update an expected file, run the matching case with the conformance runner, inspect the result, and replace the corresponding file under `conformance/expected/`, `conformance/expected-errors/`, `conformance/expected-warnings/`, or `conformance/expected-proofs/` deliberately.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
answer(pair(a, [b, c])).
|
|
2
|
+
why(
|
|
3
|
+
answer(pair(a, [b, c])),
|
|
4
|
+
proof(
|
|
5
|
+
goal(answer(pair(a, [b, c]))),
|
|
6
|
+
by(rule("<stdin>", clause(3))),
|
|
7
|
+
bindings([binding("?term", pair(a, [b, c]))]),
|
|
8
|
+
uses([
|
|
9
|
+
proof(
|
|
10
|
+
goal(source(pair(a, [b, c]))),
|
|
11
|
+
by(fact("<stdin>", clause(2)))
|
|
12
|
+
)
|
|
13
|
+
])
|
|
14
|
+
)
|
|
15
|
+
).
|
|
16
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
answer(ok).
|
|
2
|
+
why(
|
|
3
|
+
answer(ok),
|
|
4
|
+
proof(
|
|
5
|
+
goal(answer(ok)),
|
|
6
|
+
by(rule("<stdin>", clause(4))),
|
|
7
|
+
uses([
|
|
8
|
+
proof(
|
|
9
|
+
goal(left(ok)),
|
|
10
|
+
by(fact("<stdin>", clause(2)))
|
|
11
|
+
),
|
|
12
|
+
proof(
|
|
13
|
+
goal(right(ok)),
|
|
14
|
+
by(fact("<stdin>", clause(3)))
|
|
15
|
+
)
|
|
16
|
+
])
|
|
17
|
+
)
|
|
18
|
+
).
|
|
19
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
label(<urn:example:a>, "Alice").
|
|
2
|
+
why(
|
|
3
|
+
label(<urn:example:a>, "Alice"),
|
|
4
|
+
proof(
|
|
5
|
+
goal(label(<urn:example:a>, "Alice")),
|
|
6
|
+
by(rule("<stdin>", clause(3))),
|
|
7
|
+
bindings([binding("?iri", <urn:example:a>), binding("?name", "Alice")]),
|
|
8
|
+
uses([
|
|
9
|
+
proof(
|
|
10
|
+
goal(name(<urn:example:a>, "Alice")),
|
|
11
|
+
by(fact("<stdin>", clause(2)))
|
|
12
|
+
)
|
|
13
|
+
])
|
|
14
|
+
)
|
|
15
|
+
).
|
|
16
|
+
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
answer(b).
|
|
2
|
+
why(
|
|
3
|
+
answer(b),
|
|
4
|
+
proof(
|
|
5
|
+
goal(answer(b)),
|
|
6
|
+
by(rule("<stdin>", clause(2))),
|
|
7
|
+
bindings([binding("?x", b)]),
|
|
8
|
+
uses([
|
|
9
|
+
proof(
|
|
10
|
+
goal(member(b, [a, b])),
|
|
11
|
+
by(builtin(member, 2))
|
|
12
|
+
),
|
|
13
|
+
proof(
|
|
14
|
+
goal(eq(b, b)),
|
|
15
|
+
by(builtin(eq, 2))
|
|
16
|
+
)
|
|
17
|
+
])
|
|
18
|
+
)
|
|
19
|
+
).
|
|
20
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
answer(a).
|
|
2
|
+
why(
|
|
3
|
+
answer(a),
|
|
4
|
+
proof(
|
|
5
|
+
goal(answer(a)),
|
|
6
|
+
by(rule("<stdin>", clause(4))),
|
|
7
|
+
bindings([binding("?x", a)]),
|
|
8
|
+
uses([
|
|
9
|
+
proof(
|
|
10
|
+
goal(once(choice(a))),
|
|
11
|
+
by(builtin(once, 1)),
|
|
12
|
+
uses([
|
|
13
|
+
proof(
|
|
14
|
+
goal(choice(a)),
|
|
15
|
+
by(fact("<stdin>", clause(2)))
|
|
16
|
+
)
|
|
17
|
+
])
|
|
18
|
+
)
|
|
19
|
+
])
|
|
20
|
+
)
|
|
21
|
+
).
|
|
22
|
+
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
path(a, b).
|
|
2
|
+
why(
|
|
3
|
+
path(a, b),
|
|
4
|
+
proof(
|
|
5
|
+
goal(path(a, b)),
|
|
6
|
+
by(rule("<stdin>", clause(5))),
|
|
7
|
+
bindings([binding("?x", a), binding("?y", b)]),
|
|
8
|
+
uses([
|
|
9
|
+
proof(
|
|
10
|
+
goal(edge(a, b)),
|
|
11
|
+
by(fact("<stdin>", clause(3)))
|
|
12
|
+
)
|
|
13
|
+
])
|
|
14
|
+
)
|
|
15
|
+
).
|
|
16
|
+
|
|
17
|
+
path(b, c).
|
|
18
|
+
why(
|
|
19
|
+
path(b, c),
|
|
20
|
+
proof(
|
|
21
|
+
goal(path(b, c)),
|
|
22
|
+
by(rule("<stdin>", clause(5))),
|
|
23
|
+
bindings([binding("?x", b), binding("?y", c)]),
|
|
24
|
+
uses([
|
|
25
|
+
proof(
|
|
26
|
+
goal(edge(b, c)),
|
|
27
|
+
by(fact("<stdin>", clause(4)))
|
|
28
|
+
)
|
|
29
|
+
])
|
|
30
|
+
)
|
|
31
|
+
).
|
|
32
|
+
|
|
33
|
+
path(a, c).
|
|
34
|
+
why(
|
|
35
|
+
path(a, c),
|
|
36
|
+
proof(
|
|
37
|
+
goal(path(a, c)),
|
|
38
|
+
by(rule("<stdin>", clause(6))),
|
|
39
|
+
bindings([binding("?x", a), binding("?z", c), binding("?y", b)]),
|
|
40
|
+
uses([
|
|
41
|
+
proof(
|
|
42
|
+
goal(edge(a, b)),
|
|
43
|
+
by(fact("<stdin>", clause(3)))
|
|
44
|
+
),
|
|
45
|
+
proof(
|
|
46
|
+
goal(path(b, c)),
|
|
47
|
+
by(rule("<stdin>", clause(5))),
|
|
48
|
+
bindings([binding("?x", b), binding("?y", c)]),
|
|
49
|
+
uses([
|
|
50
|
+
proof(
|
|
51
|
+
goal(edge(b, c)),
|
|
52
|
+
by(fact("<stdin>", clause(4)))
|
|
53
|
+
)
|
|
54
|
+
])
|
|
55
|
+
)
|
|
56
|
+
])
|
|
57
|
+
)
|
|
58
|
+
).
|
|
59
|
+
|
|
@@ -7,12 +7,14 @@ import path from 'node:path';
|
|
|
7
7
|
import { fileURLToPath } from 'node:url';
|
|
8
8
|
|
|
9
9
|
const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)));
|
|
10
|
+
const packageRoot = path.resolve(root, '..');
|
|
10
11
|
const conformanceRoot = path.join(root, 'conformance');
|
|
11
12
|
|
|
12
13
|
const KINDS = [
|
|
13
14
|
{ kind: 'cases', expectedKind: 'expected', expectedExt: '.eye', column: 'positive' },
|
|
14
15
|
{ kind: 'errors', expectedKind: 'expected-errors', expectedExt: '.txt', column: 'errors' },
|
|
15
16
|
{ kind: 'warnings', expectedKind: 'expected-warnings', expectedExt: '.eye', column: 'warnings' },
|
|
17
|
+
{ kind: 'proofs', expectedKind: 'expected-proofs', expectedExt: '.eye', column: 'proofs' },
|
|
16
18
|
];
|
|
17
19
|
|
|
18
20
|
export function buildConformanceReport() {
|
|
@@ -45,8 +47,9 @@ export function buildConformanceReport() {
|
|
|
45
47
|
positive: acc.positive + row.positive,
|
|
46
48
|
errors: acc.errors + row.errors,
|
|
47
49
|
warnings: acc.warnings + row.warnings,
|
|
50
|
+
proofs: acc.proofs + row.proofs,
|
|
48
51
|
total: acc.total + row.total,
|
|
49
|
-
}), { positive: 0, errors: 0, warnings: 0, total: 0 });
|
|
52
|
+
}), { positive: 0, errors: 0, warnings: 0, proofs: 0, total: 0 });
|
|
50
53
|
|
|
51
54
|
return { rows, total, issues: issues.sort() };
|
|
52
55
|
}
|
|
@@ -57,14 +60,14 @@ export function formatConformanceReport(report = buildConformanceReport()) {
|
|
|
57
60
|
'',
|
|
58
61
|
'This report summarizes the file-based conformance corpus under `test/conformance/`.',
|
|
59
62
|
'',
|
|
60
|
-
'| Category | Positive | Errors | Warnings | Total |',
|
|
61
|
-
'
|
|
63
|
+
'| Category | Positive | Errors | Warnings | Proofs | Total |',
|
|
64
|
+
'|---|---:|---:|---:|---:|---:|',
|
|
62
65
|
];
|
|
63
66
|
|
|
64
67
|
for (const row of report.rows) {
|
|
65
|
-
lines.push(`| ${row.category} | ${row.positive} | ${row.errors} | ${row.warnings} | ${row.total} |`);
|
|
68
|
+
lines.push(`| ${row.category} | ${row.positive} | ${row.errors} | ${row.warnings} | ${row.proofs} | ${row.total} |`);
|
|
66
69
|
}
|
|
67
|
-
lines.push(`| **Total** | **${report.total.positive}** | **${report.total.errors}** | **${report.total.warnings}** | **${report.total.total}** |`);
|
|
70
|
+
lines.push(`| **Total** | **${report.total.positive}** | **${report.total.errors}** | **${report.total.warnings}** | **${report.total.proofs}** | **${report.total.total}** |`);
|
|
68
71
|
|
|
69
72
|
if (report.issues.length > 0) {
|
|
70
73
|
lines.push('', '## Corpus issues', '');
|
|
@@ -95,7 +98,7 @@ function categoryOf(file) {
|
|
|
95
98
|
function ensureCategory(categories, category) {
|
|
96
99
|
let counts = categories.get(category);
|
|
97
100
|
if (!counts) {
|
|
98
|
-
counts = { positive: 0, errors: 0, warnings: 0, total: 0 };
|
|
101
|
+
counts = { positive: 0, errors: 0, warnings: 0, proofs: 0, total: 0 };
|
|
99
102
|
categories.set(category, counts);
|
|
100
103
|
}
|
|
101
104
|
return counts;
|
|
@@ -103,6 +106,15 @@ function ensureCategory(categories, category) {
|
|
|
103
106
|
|
|
104
107
|
if (process.argv[1] != null && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|
|
105
108
|
const report = buildConformanceReport();
|
|
106
|
-
|
|
109
|
+
const text = formatConformanceReport(report);
|
|
110
|
+
const outputPath = process.argv[2] ?? null;
|
|
111
|
+
if (outputPath == null) {
|
|
112
|
+
process.stdout.write(text);
|
|
113
|
+
} else {
|
|
114
|
+
const resolved = path.resolve(packageRoot, outputPath);
|
|
115
|
+
fs.mkdirSync(path.dirname(resolved), { recursive: true });
|
|
116
|
+
fs.writeFileSync(resolved, text);
|
|
117
|
+
process.stdout.write(`wrote ${path.relative(packageRoot, resolved)}\n`);
|
|
118
|
+
}
|
|
107
119
|
if (report.issues.length > 0) process.exit(1);
|
|
108
120
|
}
|
package/test/run-conformance.mjs
CHANGED
|
@@ -20,6 +20,7 @@ export function runConformance(reporter = new TestReporter(), requestedFilter =
|
|
|
20
20
|
for (const file of listCaseFiles('cases', filter)) runCaseFile(reporter, file);
|
|
21
21
|
for (const file of listCaseFiles('errors', filter)) runErrorFile(reporter, file);
|
|
22
22
|
for (const file of listCaseFiles('warnings', filter)) runWarningFile(reporter, file);
|
|
23
|
+
for (const file of listCaseFiles('proofs', filter)) runProofFile(reporter, file);
|
|
23
24
|
reporter.sectionTotal(`conformance ${label}`);
|
|
24
25
|
}
|
|
25
26
|
|
|
@@ -70,6 +71,11 @@ function runWarningFile(reporter, file) {
|
|
|
70
71
|
reporter.test(`warning/${name}`, () => runWarningCase(name, file));
|
|
71
72
|
}
|
|
72
73
|
|
|
74
|
+
function runProofFile(reporter, file) {
|
|
75
|
+
const name = file.slice(0, -4);
|
|
76
|
+
reporter.test(`proof/${name}`, () => runProofCase(name, file));
|
|
77
|
+
}
|
|
78
|
+
|
|
73
79
|
function runCase(name, file) {
|
|
74
80
|
const casesDir = path.join(root, 'conformance', 'cases');
|
|
75
81
|
const expectedDir = path.join(root, 'conformance', 'expected');
|
|
@@ -122,6 +128,29 @@ function runWarningCase(name, file) {
|
|
|
122
128
|
compareExpectedFile(expectedStderr, result.stderr, name, 'warning stderr');
|
|
123
129
|
}
|
|
124
130
|
|
|
131
|
+
function runProofCase(name, file) {
|
|
132
|
+
const proofsDir = path.join(root, 'conformance', 'proofs');
|
|
133
|
+
const expectedDir = path.join(root, 'conformance', 'expected-proofs');
|
|
134
|
+
const programFile = path.join(proofsDir, file);
|
|
135
|
+
const expected = path.join(expectedDir, `${name}.eye`);
|
|
136
|
+
const text = fs.readFileSync(programFile, 'utf8');
|
|
137
|
+
const result = spawnSync(process.execPath, [cliBin, '--proof', '-'], {
|
|
138
|
+
cwd: packageRoot,
|
|
139
|
+
input: text,
|
|
140
|
+
encoding: 'utf8',
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
if (result.status !== 0) {
|
|
144
|
+
throw new Error(`proof case ${name} exited with ${result.status}\n${result.stderr}`.trimEnd());
|
|
145
|
+
}
|
|
146
|
+
if (result.stderr !== '') {
|
|
147
|
+
throw new Error(`proof case ${name} wrote unexpected stderr\n${result.stderr}`.trimEnd());
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
compareExpectedFile(expected, result.stdout, name, 'proof output');
|
|
151
|
+
Program.parse(result.stdout);
|
|
152
|
+
}
|
|
153
|
+
|
|
125
154
|
function compareExpectedFile(expected, actual, name, kind) {
|
|
126
155
|
if (!fs.existsSync(expected)) {
|
|
127
156
|
throw new Error(`missing expected ${kind} file: ${path.relative(root, expected)}`);
|
package/test/run-regression.mjs
CHANGED
|
@@ -372,12 +372,22 @@ function documentationSyncCases() {
|
|
|
372
372
|
const report = buildConformanceReport();
|
|
373
373
|
assertArrayEqual(report.issues, [], 'conformance report issues');
|
|
374
374
|
assertEqual(report.total.total >= 250, true, 'conformance case count');
|
|
375
|
-
assertEqual(report.total.positive + report.total.errors + report.total.warnings, report.total.total, 'conformance total');
|
|
375
|
+
assertEqual(report.total.positive + report.total.errors + report.total.warnings + report.total.proofs, report.total.total, 'conformance total');
|
|
376
376
|
const text = formatConformanceReport(report);
|
|
377
377
|
assertIncludes(text, '| variables |', 'report');
|
|
378
|
+
assertIncludes(text, '| Proofs |', 'report');
|
|
378
379
|
assertIncludes(text, '| **Total** |', 'report');
|
|
379
380
|
},
|
|
380
381
|
},
|
|
382
|
+
|
|
383
|
+
{
|
|
384
|
+
name: 'committed conformance report is current',
|
|
385
|
+
run: () => {
|
|
386
|
+
const reportFile = path.join(packageRoot, 'conformance-report.md');
|
|
387
|
+
assertEqual(fs.existsSync(reportFile), true, 'conformance-report.md exists');
|
|
388
|
+
assertEqual(fs.readFileSync(reportFile, 'utf8'), formatConformanceReport(buildConformanceReport()), 'conformance-report.md');
|
|
389
|
+
},
|
|
390
|
+
},
|
|
381
391
|
{
|
|
382
392
|
name: 'source-checkout setup docs match package bin',
|
|
383
393
|
run: () => {
|