Skip to content

«Tests» starts as ▶ Ausführen: empty console, fresh session, then the report - #36

Merged
cedricvogel-leo merged 1 commit into
mainfrom
feature/tests-like-run
Oct 26, 2026
Merged

cedricvogel-leo merged 1 commit into
mainfrom
feature/tests-like-run

Conversation

@cedricvogel-leo

Copy link
Copy Markdown
Collaborator

For v0.1.15: «Tests» behaves like ▶ Ausführen, in the embed and the IDE alike.

Before

Tests loaded the file into a namespace of its own and appended its report. The REPL kept the definitions of the last Run. After editing and pressing Tests, f() in the REPL still used the old f (or raised NameError if there had been no Run) until ▶ Ausführen.

Now

  1. Like Run: the console is emptied. The current files run as __main__ in a fresh REPL session, their output streams into the console, and the REPL's replay record (2c) starts anew. All of this is the same code as Run: the worker's runProgram, now used by run and test.
  2. Then the doctests, and their report below the program's output.
  • The REPL afterwards has exactly the definitions just tested.
  • If the file itself fails while loading, its traceback and hint (from the Run part) are the answer, and no report repeats the load error (test-result with skipped).
  • The report no longer shows what the file printed while loading: the Run part already showed it above.
  • Unchanged: «Beispiel visualisieren» on a failing example (still against the doctest run's definitions), and P20: a new Tests report is shown, not appended out of view #34's reveal of REPL answers, reports and the stop note.

Tests

npm run test:console (in CI):

  • Tests → fail → edit → Tests, and Tests → pass → edit → Tests: the console then holds only the new report, which tests the edited code and is in view.
  • New: Tests → REPL f() → 1; edit → Tests (no Run) → REPL f() → 2.
  • Against main's build all three fail: two reports instead of one, and the REPL answers NameError: name 'f' is not defined after Tests without a Run.

Also checked by hand:

  • Embed: a file with 1 / 0 at the end gives its output, the traceback and the hint, no report, and Tests works again after the fix. «Beispiel visualisieren» shows «Erhalten: 4 · Erwartet: 5».
  • IDE: after Tests, f() → 1. After an edit and Tests, the console holds only «(Keine Ausgabe)» and «1 von 1 Beispielen bestanden», and f() → 2.

Note: a file that asks for input() while loading now asks twice per Tests run (Run part, then the doctest load). The course doesn't use input().

Lint (known warning only), both builds, test:protocol, test:hints, test:runtime and test:console pass. After the merge I tag v0.1.15 and bump the IDE.

🤖 Generated with Claude Code

Tests used to load the file into a namespace of its own and append its
report, so after an edit and Tests the REPL still held the definitions of
the last Run. Now Tests first does what Run does - an empty console, the
current files run as __main__ into a fresh REPL session (output streams,
the REPL's replay record starts anew) - and then runs the doctests and
shows their report. The REPL then has exactly the definitions just tested.
If the file itself fails, its traceback and hint are the answer and no
report repeats the load error. The report no longer shows what the file
printed while loading; the Run part already did.

The worker's run is one function now (runProgram), used by run and test.
#34's reveal of REPL answers, reports and the stop note stays.

test:console: the second Tests run leaves only its own report, and a new
scenario checks Tests → REPL → edit → Tests → REPL uses the new definition.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cedricvogel-leo
cedricvogel-leo merged commit 661e81a into main Oct 26, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant