Updoc

Updoc is a tool for creating checkable documentation and regression tests.

Please read more about it here: http://www.erights.org/elang/tools/updoc.html

E specification
The E specification contained in this wiki incorporates a test suite written in Updoc.

Running Updoc
In E-on-Java, the program  runs Updoc tests. It takes one argument which is an Updoc file or a directory containing them. Updoc may be by itself, embedded in E source, or embedded in HTML.

Updoc syntax and behavior
An updoc test failure occurs when the actual answers resulting from evaluation are not equal (except for stack traces) to the expected answers written in the test script.

Parsing
Exactly like an interactive session, parser pragmas persist from one step to the next.

? accum [] for _ in "" { _ + [1] }; null ? pragma.enable("accumulator") ? accum [] for _ in "" { _ + [1] }; null ? pragma.syntax("0.9") ? accum [] for _ in "" { _ + [1] }; null
 * 1) syntax error: The optional e.enable.accumulator feature (see org/erights/e/elang/syntax/syntax-props-default.txt) is currently off.
 * 1) syntax error: The optional e.enable.accumulator feature (see org/erights/e/elang/syntax/syntax-props-default.txt) is currently off.

Printing
In the Updoc environment, the text printed via the output objects,  ,  , and   is part of the results checked.

Semantics: stdout and stderr write to separate buffers. At the following times in the execution of each step, the contents of each buffer, if nonempty, are moved into answers named "stdout" and "stderr":
 * after evaluation of the step, but before the  is printed
 * after interp.waitAtTop/blockAtTop pauses and after all turns queued by the step have executed, but before the evaluation of the next step

Line breaks and buffers:

? stdout.print("a") ? stdout.print("a\n") ? stdout.print("a"); stderr.print("b")
 * 1) stdout: a
 * 1) stdout: a
 * 1) stdout: a
 * 1) stderr: b

Timing:

? stdout.print("a"); stdout <- print("b"); "c" ? # This step should have no output.
 * 1) stdout: a
 * 1) value: "c"
 * 1) stdout: b

and :

? println("a", "b"); print("c", "d")
 * 1) stdout: ab
 * 2)         cd