https://github.com/suzannesoy/repltest
REPLtest: Copy-paste your REPL interactions, and have them run as tests
https://github.com/suzannesoy/repltest
racket-library
Last synced: 5 months ago
JSON representation
REPLtest: Copy-paste your REPL interactions, and have them run as tests
- Host: GitHub
- URL: https://github.com/suzannesoy/repltest
- Owner: SuzanneSoy
- License: other
- Created: 2016-03-30T15:59:50.000Z (about 10 years ago)
- Default Branch: main
- Last Pushed: 2021-04-04T14:29:05.000Z (about 5 years ago)
- Last Synced: 2025-01-30T11:42:06.592Z (over 1 year ago)
- Topics: racket-library
- Language: Racket
- Homepage: http://docs.racket-lang.org/repltest/
- Size: 29.3 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[](https://travis-ci.org/jsmaniac/repltest)
[](https://coveralls.io/github/jsmaniac/repltest)
[](http://jsmaniac.github.io/travis-stats/#jsmaniac/repltest)
[](http://docs.racket-lang.org/repltest/)
[](https://github.com/jsmaniac/repltest/issues)
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.