eyeling 1.24.15 → 1.24.16
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/HANDBOOK.md +1 -1
- package/package.json +1 -1
- package/test/playground.test.js +33 -6
package/HANDBOOK.md
CHANGED
|
@@ -3731,7 +3731,7 @@ This matters because the playground is not just a text box plus a submit button.
|
|
|
3731
3731
|
|
|
3732
3732
|
The output behavior also adapts to the kind of N3 program being run. In some cases the natural result is a streamed list of derived triples. In others, such as programs using output-oriented constructs like `log:outputString`, a rendered text result is more appropriate. The playground supports both styles.
|
|
3733
3733
|
|
|
3734
|
-
For Markdown-oriented `log:outputString` examples, the output pane has two views: a rendered Markdown view and a Markdown source view. The rendered view is selected by default
|
|
3734
|
+
For Markdown-oriented `log:outputString` examples, the output pane has two views: a rendered Markdown view and a Markdown source view. Those tabs appear only when the actual output looks like Markdown; Turtle or other plain output stays in the source editor without the Markdown toggle. The rendered view is selected by default for Markdown output, while the source view keeps the exact generated Markdown available for copying, inspection, or comparison.
|
|
3735
3735
|
|
|
3736
3736
|
Repository example reports often contain relative source links that are written for the checked-in files under `examples/output/*.md`. When such an example is loaded into the playground from a raw URL, the rendered Markdown view resolves those relative links against the corresponding static output page rather than against `/playground`, so links like `../name.n3` and `../input/name.trig` continue to point to the intended example files.
|
|
3737
3737
|
|
package/package.json
CHANGED
package/test/playground.test.js
CHANGED
|
@@ -24,8 +24,8 @@ const C = TTY
|
|
|
24
24
|
: { g: '', r: '', y: '', dim: '', n: '' };
|
|
25
25
|
const msTag = (ms) => `${C.dim}(${ms} ms)${C.n}`;
|
|
26
26
|
|
|
27
|
-
const TOTAL_TESTS =
|
|
28
|
-
const idxWidth = String(TOTAL_TESTS).length;
|
|
27
|
+
const TOTAL_TESTS = (fs.readFileSync(__filename, 'utf8').match(/^\s*beginTest\(/gm) || []).length;
|
|
28
|
+
const idxWidth = String(Math.max(1, TOTAL_TESTS)).length;
|
|
29
29
|
let passed = 0;
|
|
30
30
|
let failed = 0;
|
|
31
31
|
let currentTest = null;
|
|
@@ -816,6 +816,13 @@ ${JSON.stringify(last, null, 2)}`);
|
|
|
816
816
|
const outputStringProgram = `@prefix : <#> .
|
|
817
817
|
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
|
|
818
818
|
:report log:outputString "## Hello from output string\n\nLine 2 with **bold** and [Eyeling](https://example.org/eyeling)\n" .
|
|
819
|
+
`;
|
|
820
|
+
const logQueryTurtleProgram = `@prefix : <#> .
|
|
821
|
+
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
|
|
822
|
+
|
|
823
|
+
:Socrates a :Human .
|
|
824
|
+
{ ?x a :Human } => { ?x a :Mortal } .
|
|
825
|
+
{ ?s ?p ?o } log:query { ?s ?p ?o } .
|
|
819
826
|
`;
|
|
820
827
|
|
|
821
828
|
// 1) Baseline smoke test: the default program runs to completion.
|
|
@@ -917,7 +924,27 @@ ${JSON.stringify(last, null, 2)}`);
|
|
|
917
924
|
assert.ok(compactShareUrl.length < playgroundUrl.length + encodeURIComponent(outputStringProgram).length, 'Expected compact share URL to be shorter than raw editor URL');
|
|
918
925
|
endTest();
|
|
919
926
|
|
|
920
|
-
// 6)
|
|
927
|
+
// 6) log:query can produce Turtle; that should stay in plain source output without Markdown tabs.
|
|
928
|
+
beginTest('playground hides markdown tabs for Turtle log:query output');
|
|
929
|
+
await setProgram(logQueryTurtleProgram);
|
|
930
|
+
await clickRun();
|
|
931
|
+
const logQueryTurtle = await waitForState(
|
|
932
|
+
'log:query Turtle output completion',
|
|
933
|
+
(st) =>
|
|
934
|
+
String(st.status || '')
|
|
935
|
+
.trim()
|
|
936
|
+
.startsWith('Done') && /:Socrates\s+a\s+:Mortal\s*\./.test(String(st.output || '')),
|
|
937
|
+
30000,
|
|
938
|
+
);
|
|
939
|
+
assert.match(logQueryTurtle.output, /:Socrates\s+a\s+:Human\s*\./, 'Expected Turtle-style source output');
|
|
940
|
+
assert.match(logQueryTurtle.output, /:Socrates\s+a\s+:Mortal\s*\./, 'Expected inferred Turtle-style source output');
|
|
941
|
+
assert.doesNotMatch(logQueryTurtle.output, /^#{1,6}\s+/m, 'Expected non-Markdown Turtle output');
|
|
942
|
+
assert.equal(logQueryTurtle.outputTabsHidden, true, 'Expected Turtle log:query output to hide Markdown tabs');
|
|
943
|
+
assert.equal(logQueryTurtle.renderedHidden, true, 'Expected Turtle log:query output to skip rendered Markdown panel');
|
|
944
|
+
assert.equal(logQueryTurtle.sourceHidden, false, 'Expected Turtle log:query output to show source directly');
|
|
945
|
+
endTest();
|
|
946
|
+
|
|
947
|
+
// 7) URL-loaded examples should auto-load matching examples/input/<stem>.trig and run in RDF/TriG mode.
|
|
921
948
|
beginTest('playground auto-loads companion TriG sidecars and uses RDF/TriG mode');
|
|
922
949
|
await loadUrlIntoEditor('https://raw.githubusercontent.com/eyereasoner/eyeling/refs/heads/main/examples/smoke-arithmetic.n3');
|
|
923
950
|
const smokeLoaded = await waitForState(
|
|
@@ -948,7 +975,7 @@ ${JSON.stringify(last, null, 2)}`);
|
|
|
948
975
|
);
|
|
949
976
|
endTest();
|
|
950
977
|
|
|
951
|
-
//
|
|
978
|
+
// 8) URL-loaded repository examples should auto-load matching examples/builtin/<stem>.js.
|
|
952
979
|
beginTest('playground auto-loads a companion example builtin for URL-loaded Sudoku');
|
|
953
980
|
await loadUrlIntoEditor('https://raw.githubusercontent.com/eyereasoner/eyeling/refs/heads/main/examples/sudoku.n3');
|
|
954
981
|
await waitForState(
|
|
@@ -972,12 +999,12 @@ ${JSON.stringify(last, null, 2)}`);
|
|
|
972
999
|
assert.match(sudoku.output, /unique valid Sudoku solution/i, 'Expected Sudoku builtin-backed result');
|
|
973
1000
|
endTest();
|
|
974
1001
|
|
|
975
|
-
// Ensure no uncaught runtime exceptions.
|
|
1002
|
+
// 9) Ensure no uncaught runtime exceptions.
|
|
976
1003
|
beginTest('playground has no uncaught runtime exceptions');
|
|
977
1004
|
assert.equal(exceptions.length, 0, `Uncaught exceptions in playground.html: ${JSON.stringify(exceptions[0] || {})}`);
|
|
978
1005
|
endTest();
|
|
979
1006
|
|
|
980
|
-
// Console errors are noisy and often indicate a broken UI.
|
|
1007
|
+
// 10) Console errors are noisy and often indicate a broken UI.
|
|
981
1008
|
// (We suppress known noise like /favicon.ico on the server.)
|
|
982
1009
|
beginTest('playground has no console errors');
|
|
983
1010
|
assert.equal(consoleErrors.length, 0, `Console errors in playground.html: ${JSON.stringify(consoleErrors[0] || {})}`);
|