REPLtest: Copy-paste your REPL interactions, and have them run as tests
Go to file
2021-04-04 07:22:51 +01:00
lang Removed replace-top-loc which was unused, moved it to 76788aba64/stx/fold.rkt 2016-09-05 15:49:10 +02:00
private Fixed GH issue #3 (again) 2016-03-31 13:29:16 +02:00
scribblings Added e-mail address 2021-03-04 21:00:44 +00:00
test Remove dependency on debug for the meta-language test, since debug seems to have some backward compatibility issues. Use AFL instead. Bumped built versions for Travis. 2017-01-14 23:06:20 +01:00
.gitignore Reader and evaluator mostly work. Still need to evaluate the read tests. 2016-03-30 16:21:14 +02:00
.travis.yml Updated Racket versions in .travis.yml 2019-04-24 22:37:55 +02:00
info.rkt Changed my name :) 2021-03-04 20:37:55 +00:00
LICENSE.txt Changed my name :) 2021-03-04 20:51:37 +00:00
main.rkt Circumvented raco cover issue with eval and fixed srcloc for reader-injected code, as suggested by Spencer Florence https://github.com/florence/cover/issues/128#issuecomment-240503899 2016-08-17 21:29:10 +02:00
README.md Renamed main branch 2021-04-04 07:22:51 +01:00

Build Status, Coverage Status, Build Stats, Online Documentation, Maintained as of 2018.

REPLtest

This package provides the #lang repltest meta-language, which can be used to turn the transcript of an interactive racket session into a series of tests.

Installation

Install this package with:

raco pkg install --deps search-auto repltest

Usage

Write a file using the repltest meta-language, containing definitions at the top and interactions after the first prompt (by default the prompt is "> ", I will add customization options later). Each prompt is followed by a single expression and by the expected result.

#lang debug repltest typed/racket
;; There is a problem if there is a comment before a prompt, as comments
;; are not gobbled-up by the preceding read. This will be fixed in a
;; later version.
(define x 0)
(define y 1)
'displayed
(displayln "displayed too")

> (+ 1 1)
- : Integer [more precisely: Positive-Index]
2
> x
- : Integer [more precisely: Zero]
0
> (values x y)
- : (values Integer Integer) [more precisely: (Values Zero One)]
0
1
> #R(+ 2 0)
(+ 2 0) = 2
- : Integer [more precisely: Positive-Byte]
2

When the test submodule of this file is executed (e.g. with raco test file.rkt), repltest runs the expression after each > prompt, and checks the expected result is produced.