nix icon indicating copy to clipboard operation
nix copied to clipboard

WIP: literate repl tests

Open lf- opened this issue 1 year ago • 0 comments

Motivation

What if we could write repl tests that were basically just repl sessions? We could test the debugger! We could do a great many things!

This PR brings generic infrastructure for writing literate tests, and a concrete implemention to attach them to the repl. It is unfinished and could use a good refactor pass, but is being presented as-is for comment.

The current state of this is that it works with readline except it does not work under editline, because in the infinite wisdom of the editline developers, no prompts are printed in editline if it's not attached to a tty. I will fix this by either attaching to a pty or implementing a machine readable mode for the repl that always prints some special character as a prompt.

There is an example test using it in the PR.

Context

Do note that someone else wrote something vaguely similar: https://github.com/mobusoperandi/eelco

I didn't use it because I didn't think it was really ideal to depend on someone else's unfinished, out-of-tree test driver for internal tests. Also, as far as I can tell, it looks less likely to be able to support testing the debugger.

The inspiration for this work is: https://bitheap.org/cram/

Priorities and Process

Add :+1: to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

lf- avatar Feb 25 '24 04:02 lf-