Compare commits
No commits in common. "main" and "fix-cover" have entirely different histories.
17
.travis.yml
17
.travis.yml
|
@ -27,21 +27,11 @@ env:
|
||||||
#- RACKET_VERSION=6.1
|
#- RACKET_VERSION=6.1
|
||||||
#- RACKET_VERSION=6.1.1
|
#- RACKET_VERSION=6.1.1
|
||||||
# in v6.2, error "#%module-begin: cannot use identifier tainted by macro transformation" on files which use #lang repltest typed/racket
|
# in v6.2, error "#%module-begin: cannot use identifier tainted by macro transformation" on files which use #lang repltest typed/racket
|
||||||
#- RACKET_VERSION=6.2
|
- RACKET_VERSION=6.2
|
||||||
- RACKET_VERSION=6.3
|
- RACKET_VERSION=6.3
|
||||||
- RACKET_VERSION=6.4
|
- RACKET_VERSION=6.4
|
||||||
- RACKET_VERSION=6.5
|
- RACKET_VERSION=6.5
|
||||||
- RACKET_VERSION=6.6
|
- RACKET_VERSION=6.6
|
||||||
- RACKET_VERSION=6.7
|
|
||||||
- RACKET_VERSION=6.8
|
|
||||||
- RACKET_VERSION=6.9
|
|
||||||
- RACKET_VERSION=6.10
|
|
||||||
- RACKET_VERSION=6.10.1
|
|
||||||
- RACKET_VERSION=6.11
|
|
||||||
- RACKET_VERSION=6.12
|
|
||||||
- RACKET_VERSION=7.0
|
|
||||||
- RACKET_VERSION=7.1
|
|
||||||
- RACKET_VERSION=7.2
|
|
||||||
- RACKET_VERSION=HEAD
|
- RACKET_VERSION=HEAD
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
|
@ -65,9 +55,10 @@ before_script:
|
||||||
# `raco pkg install --deps search-auto repltest` to install any required
|
# `raco pkg install --deps search-auto repltest` to install any required
|
||||||
# packages without it getting stuck on a confirmation prompt.
|
# packages without it getting stuck on a confirmation prompt.
|
||||||
script:
|
script:
|
||||||
- raco test -p repltest
|
- raco test -x -p repltest
|
||||||
- raco setup --check-pkg-deps --pkgs repltest
|
- raco setup --check-pkg-deps --pkgs repltest
|
||||||
|
|
||||||
after_success:
|
after_success:
|
||||||
- raco pkg install --deps search-auto cover cover-coveralls
|
#- raco pkg install --deps search-auto cover cover-coveralls
|
||||||
|
- raco pkg install --deps search-auto https://github.com/jsmaniac/cover.git#fix-vector-ref-minus-one cover-coveralls
|
||||||
- raco cover --verbose -b -f coveralls -d $TRAVIS_BUILD_DIR/coverage .
|
- raco cover --verbose -b -f coveralls -d $TRAVIS_BUILD_DIR/coverage .
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
repltest
|
repltest
|
||||||
Copyright (c) 2016 Suzanne Soy
|
Copyright (c) 2016 georges
|
||||||
|
|
||||||
This package is distributed under the GNU Lesser General Public
|
This package is distributed under the GNU Lesser General Public
|
||||||
License (LGPL). This means that you can link repltest into proprietary
|
License (LGPL). This means that you can link repltest into proprietary
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
[](https://travis-ci.org/jsmaniac/repltest)
|
[](https://travis-ci.org/jsmaniac/repltest)
|
||||||
[](https://coveralls.io/github/jsmaniac/repltest)
|
[](https://coveralls.io/github/jsmaniac/repltest)
|
||||||
[](http://jsmaniac.github.io/travis-stats/#jsmaniac/repltest)
|
[](http://jsmaniac.github.io/travis-stats/#jsmaniac/repltest)
|
||||||
[](http://docs.racket-lang.org/repltest/)
|
[](http://docs.racket-lang.org/repltest/)
|
||||||
[](https://github.com/jsmaniac/repltest/issues)
|
|
||||||
|
|
||||||
REPLtest
|
REPLtest
|
||||||
========
|
========
|
||||||
|
|
4
info.rkt
4
info.rkt
|
@ -3,9 +3,9 @@
|
||||||
(define deps '("base"
|
(define deps '("base"
|
||||||
"rackunit-lib"
|
"rackunit-lib"
|
||||||
"typed-racket-lib"
|
"typed-racket-lib"
|
||||||
"afl"))
|
"debug"))
|
||||||
(define build-deps '("scribble-lib" "racket-doc" "typed-racket-doc"))
|
(define build-deps '("scribble-lib" "racket-doc" "typed-racket-doc"))
|
||||||
(define scribblings '(("scribblings/repltest.scrbl" ())))
|
(define scribblings '(("scribblings/repltest.scrbl" ())))
|
||||||
(define pkg-desc "Copy-paste your REPL interactions, and have them run as tests")
|
(define pkg-desc "Copy-paste your REPL interactions, and have them run as tests")
|
||||||
(define version "0.1")
|
(define version "0.1")
|
||||||
(define pkg-authors '(|Suzanne Soy|))
|
(define pkg-authors '(|Georges Dupéron|))
|
||||||
|
|
|
@ -10,14 +10,48 @@
|
||||||
(only-in syntax/module-reader make-meta-reader)
|
(only-in syntax/module-reader make-meta-reader)
|
||||||
syntax/strip-context)
|
syntax/strip-context)
|
||||||
|
|
||||||
|
;; Replaces the syntax/loc for the top of the syntax object, until
|
||||||
|
;; a part which doesn't belong to old-source is reached.
|
||||||
|
;; e.g. (with-syntax ([d user-provided-syntax])
|
||||||
|
;; (replace-top-loc
|
||||||
|
;; #'(a b (c d e))
|
||||||
|
;; (syntax-source #'here)
|
||||||
|
;; new-loc))
|
||||||
|
;; will produce a syntax object #'(a b (c (x (y) z) e))
|
||||||
|
;; where a, b, c, z, e and their surrounding forms have their srcloc set to
|
||||||
|
;; new-loc, but (x (y) z) will be left intact, if the user-provided-syntax
|
||||||
|
;; appears in another file.
|
||||||
|
(define (replace-top-loc stx old-source new-loc)
|
||||||
|
(let process ([stx stx])
|
||||||
|
(cond
|
||||||
|
[(syntax? stx)
|
||||||
|
(if (equal? (syntax-source stx) old-source)
|
||||||
|
(datum->syntax stx (process (syntax-e stx)) new-loc stx)
|
||||||
|
stx
|
||||||
|
;; Use the following expression to replace the loc throughout stx
|
||||||
|
;; instead of stopping the depth-first-search when the syntax-source
|
||||||
|
;; is not old-source anymore
|
||||||
|
#;(datum->syntax stx (process (syntax-e stx)) stx stx))]
|
||||||
|
[(pair? stx)
|
||||||
|
(cons (process (car stx))
|
||||||
|
(process (cdr stx)))]
|
||||||
|
[(vector? stx)
|
||||||
|
(list->vector (process (vector->list stx)))]
|
||||||
|
[(prefab-struct-key stx)
|
||||||
|
=> (λ (key)
|
||||||
|
(make-prefab-struct key
|
||||||
|
(process (struct->vector stx))))]
|
||||||
|
[else
|
||||||
|
stx])))
|
||||||
|
|
||||||
(define ((wrap-reader reader) chr in src line col pos)
|
(define ((wrap-reader reader) chr in src line col pos)
|
||||||
(define/with-syntax orig-mod
|
(define/with-syntax orig-mod
|
||||||
(reader chr (narrow-until-prompt in) src line col pos))
|
(reader chr (narrow-until-prompt in) src line col pos))
|
||||||
|
|
||||||
(define/with-syntax (mod nam lang (modbeg . body))
|
(define/with-syntax (mod nam lang (modbeg . body))
|
||||||
(eval-syntax (syntax/loc #'orig-mod (expand #'orig-mod))
|
#;(eval-syntax (syntax/loc #'orig-mod (expand #'orig-mod))
|
||||||
(variable-reference->namespace (#%variable-reference)))
|
(variable-reference->namespace (#%variable-reference)))
|
||||||
#;(parameterize ([current-namespace (variable-reference->namespace
|
(parameterize ([current-namespace (variable-reference->namespace
|
||||||
(#%variable-reference))])
|
(#%variable-reference))])
|
||||||
(expand #'orig-mod)))
|
(expand #'orig-mod)))
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
scriblib/footnote]
|
scriblib/footnote]
|
||||||
|
|
||||||
@title{REPL test: copy-paste REPL interactions to define tests}
|
@title{REPL test: copy-paste REPL interactions to define tests}
|
||||||
@author[@author+email["Suzanne Soy" "racket@suzanne.soy"]]
|
@author{Georges Dupéron}
|
||||||
|
|
||||||
Source code: @url{https://github.com/jsmaniac/repltest}
|
Source code: @url{https://github.com/jsmaniac/repltest}
|
||||||
|
|
||||||
|
@ -81,7 +81,6 @@ the expected output:
|
||||||
@#,hash-lang[] @#,racketmodname[repltest] @#,racketmodname[typed/racket]
|
@#,hash-lang[] @#,racketmodname[repltest] @#,racketmodname[typed/racket]
|
||||||
(define x 0)
|
(define x 0)
|
||||||
@#,racketid[>] x
|
@#,racketid[>] x
|
||||||
@#,racketoutput{- : Integer [more precisely: Zero]}
|
|
||||||
@#,racketresultfont{0}
|
@#,racketresultfont{0}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#lang afl repltest typed/racket
|
#lang debug repltest typed/racket
|
||||||
|
|
||||||
;; There is a problem if there is a comment before a prompt, as comments aren't
|
;; There is a problem if there is a comment before a prompt, as comments aren't
|
||||||
;; gobbled-up by the preceeding read.
|
;; gobbled-up by the preceeding read.
|
||||||
(define x 0)
|
(define x 0)
|
||||||
(define y #λ(list 3 %))
|
(define (y) #R(- 3 2))
|
||||||
(define-syntax (module->namespace stx) #'error)
|
(define-syntax (module->namespace stx) #'error)
|
||||||
(provide module->namespace)
|
(provide module->namespace)
|
||||||
'displayed
|
'displayed
|
||||||
|
@ -15,10 +15,11 @@
|
||||||
> x
|
> x
|
||||||
- : Integer [more precisely: Zero]
|
- : Integer [more precisely: Zero]
|
||||||
0
|
0
|
||||||
> (values x (y 2))
|
> (values x (y))
|
||||||
- : (values Integer (Listof Any)) [more precisely: (Values Zero (List Positive-Byte Any))]
|
(- 3 2) = 1
|
||||||
|
- : (values Integer Integer) [more precisely: (Values Zero Fixnum)]
|
||||||
0
|
0
|
||||||
'(3 2)
|
1
|
||||||
> (+ 2 0)
|
> (+ 2 0)
|
||||||
- : Integer [more precisely: Positive-Byte]
|
- : Integer [more precisely: Positive-Byte]
|
||||||
2
|
2
|
Loading…
Reference in New Issue
Block a user