Add server-side test runner to /specs/testing page
Python evaluator runs test.sx at page load, results shown alongside the browser runner. Both hosts prove the same 81 tests from the same spec file — server on render, client on click. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
;; Testing spec page — SX tests SX.
|
||||
|
||||
(defcomp ~spec-testing-content (&key spec-source)
|
||||
(defcomp ~spec-testing-content (&key spec-source server-results)
|
||||
(~doc-page :title "Testing"
|
||||
(div :class "space-y-8"
|
||||
|
||||
@@ -22,15 +22,27 @@
|
||||
(code :class "text-violet-700 text-sm" "if")
|
||||
" works. No code generation, no intermediate files — the evaluator runs the spec."))
|
||||
|
||||
;; Live test runner
|
||||
;; Server-side results (ran when this page was rendered)
|
||||
(div :class "space-y-3"
|
||||
(h2 :class "text-2xl font-semibold text-stone-800" "Run in browser")
|
||||
(h2 :class "text-2xl font-semibold text-stone-800" "Server: Python evaluator")
|
||||
(p :class "text-stone-600"
|
||||
"The Python evaluator ran "
|
||||
(code :class "text-violet-700 text-sm" "test.sx")
|
||||
" when this page loaded — "
|
||||
(strong (str (get server-results "passed") "/" (get server-results "total") " passed"))
|
||||
" in " (str (get server-results "elapsed-ms")) "ms.")
|
||||
(pre :class "text-sm font-mono bg-stone-900 text-green-400 rounded-lg p-4 overflow-x-auto max-h-96 overflow-y-auto"
|
||||
(get server-results "output")))
|
||||
|
||||
;; Client-side test runner
|
||||
(div :class "space-y-3"
|
||||
(h2 :class "text-2xl font-semibold text-stone-800" "Browser: JavaScript evaluator")
|
||||
(p :class "text-stone-600"
|
||||
"This page loaded "
|
||||
(code :class "text-violet-700 text-sm" "sx-browser.js")
|
||||
" to render itself. The same evaluator can run "
|
||||
(code :class "text-violet-700 text-sm" "test.sx")
|
||||
" right here — SX testing SX, in your browser:")
|
||||
" right here:")
|
||||
(div :class "flex items-center gap-4"
|
||||
(button :id "test-btn"
|
||||
:class "px-4 py-2 rounded-md bg-violet-600 text-white font-medium text-sm hover:bg-violet-700 cursor-pointer"
|
||||
|
||||
Reference in New Issue
Block a user