www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

README.md (1891B)


      1 [![Build Status,](https://img.shields.io/travis/jsmaniac/repltest/main.svg)](https://travis-ci.org/jsmaniac/repltest)
      2 [![Coverage Status,](https://img.shields.io/coveralls/jsmaniac/repltest/main.svg)](https://coveralls.io/github/jsmaniac/repltest)
      3 [![Build Stats,](https://img.shields.io/badge/build-stats-blue.svg)](http://jsmaniac.github.io/travis-stats/#jsmaniac/repltest)
      4 [![Online Documentation,](https://img.shields.io/badge/docs-online-blue.svg)](http://docs.racket-lang.org/repltest/)
      5 [![Maintained as of 2018.](https://img.shields.io/maintenance/yes/2018.svg)](https://github.com/jsmaniac/repltest/issues)
      6 
      7 REPLtest
      8 ========
      9 
     10 This package provides the `#lang repltest` meta-language, which can be
     11 used to turn the transcript of an interactive racket session into a
     12 series of tests.
     13 
     14 Installation
     15 ------------
     16 
     17 Install this package with:
     18 
     19 ```
     20 raco pkg install --deps search-auto repltest
     21 ```
     22 
     23 Usage
     24 -----
     25 
     26 Write a file using the repltest meta-language, containing definitions at the
     27 top and interactions after the first prompt (by default the prompt is `"> "`,
     28 I will add customization options later). Each prompt is followed by a single
     29 expression and by the expected result.
     30 
     31 ```
     32 #lang debug repltest typed/racket
     33 ;; There is a problem if there is a comment before a prompt, as comments
     34 ;; are not gobbled-up by the preceding read. This will be fixed in a
     35 ;; later version.
     36 (define x 0)
     37 (define y 1)
     38 'displayed
     39 (displayln "displayed too")
     40 
     41 > (+ 1 1)
     42 - : Integer [more precisely: Positive-Index]
     43 2
     44 > x
     45 - : Integer [more precisely: Zero]
     46 0
     47 > (values x y)
     48 - : (values Integer Integer) [more precisely: (Values Zero One)]
     49 0
     50 1
     51 > #R(+ 2 0)
     52 (+ 2 0) = 2
     53 - : Integer [more precisely: Positive-Byte]
     54 2
     55 ```
     56 
     57 When the `test` submodule of this file is executed (e.g. with `raco
     58 test file.rkt`), `repltest` runs the expression after each `> `
     59 prompt, and checks the expected result is produced.