Compare commits

..

No commits in common. "master" and "fix-div-by-zero--issue-118" have entirely different histories.

9 changed files with 47 additions and 117 deletions

View File

@ -4,6 +4,11 @@ env:
global:
- RACKET_DIR=~/racket
matrix:
- RACKET_VERSION=6.1.1
- RACKET_VERSION=6.2
- RACKET_VERSION=6.2.1
- RACKET_VERSION=6.3
- RACKET_VERSION=6.4
- RACKET_VERSION=HEAD
matrix:

View File

@ -187,7 +187,7 @@ Thus, In essence this module has three responsibilites:
;; ModulePath -> Any
(define (run-mod to-run)
(vprintf "running ~s in environment ~s" to-run (get-topic))
(vprintf "running ~s in envoronment ~s" to-run (get-topic))
(dynamic-require to-run 0)
(vprintf "finished running ~s" to-run))
@ -224,7 +224,7 @@ Thus, In essence this module has three responsibilites:
(not file))
e]
[else
(vprintf "compiling ~s with coverage annotations in environment ~s"
(vprintf "compiling ~s with coverage annotations in enviornment ~s"
file
(get-topic))
((annotate-top file)

View File

@ -1,4 +1,4 @@
#lang info
#lang setup/infotab
(define cover-formats
'(("html" cover generate-html-coverage)
@ -14,5 +14,3 @@
'(("cover" (submod cover/raco main) "a code coverage tool" 30)))
(define scribblings '(("scribblings/cover.scrbl" (multi-page))))
(define pkg-authors '("spencer@florence.io"))

View File

@ -24,10 +24,7 @@ The module implements code coverage annotations as described in cover.rkt
(define vector-name #'cover-coverage-vector)
(define make-log-receiver-name #'make-log-receiver)
(define sync-name #'sync)
(define app-name #'#%app)
(define hash-ref-name #'hash-ref)
(define bfs-name #'begin-for-syntax)
(define begin-name #'begin)
;; symbol [Hash srcloclist index] [Hash pathstring vector]
;; -> (pathstring -> annotator)
@ -46,9 +43,7 @@ The module implements code coverage annotations as described in cover.rkt
(cond [(cross-phase-persist? stx)
;; special case: cross-phase-pesistant files
;; are not coverable, but immutable so basically always covered
(define loc (stx->srcloc stx))
(when loc
(initialize-test-coverage-point stx loc))
(initialize-test-coverage-point stx)
(do-final-init! #t)
stx]
[else
@ -69,8 +64,8 @@ The module implements code coverage annotations as described in cover.rkt
e #f
[(begin e mod)
(begin
(syntax-case #'e (quote)
[(_ #;#%app vector-set vec (quote loc) (quote #t))
(syntax-case #'e (#%plain-app)
[(#%plain-app vector-set vec loc #t)
(vector-set! (hash-ref vecmapping file) (syntax-e #'loc) #t)])
#'mod)]
[_ e]))
@ -78,27 +73,21 @@ The module implements code coverage annotations as described in cover.rkt
(define initialize-test-coverage-point
(if initialized?
void
(lambda (stx loc)
(lambda (stx)
(define loc (stx->srcloc stx))
(unless (hash-has-key? loc->vecref loc)
(hash-set! loc->vecref loc (list file count))
(set! count (add1 count))))))
(define (test-covered stx loc)
(define (test-covered stx)
(define loc (stx->srcloc stx))
(with-syntax ([vector-name vector-name]
[#%papp app-name]
[unsafe-vector-set! unsafe-vector-set!-name]
[vecloc (cadr (hash-ref loc->vecref loc))])
#`(#%papp unsafe-vector-set! vector-name 'vecloc '#t)))
(define (test-coverage-point body expr phase)
(define loc (stx->srcloc expr))
(cond [loc
(initialize-test-coverage-point expr loc)
#`(#,begin-name #,(test-covered expr loc) #,body)]
[else body]))
#`(#%plain-app unsafe-vector-set! vector-name vecloc #t)))
;; ---- IN ----
(define-values/invoke-unit/infer stacktrace/annotator@)
(define-values/invoke-unit/infer stacktrace@)
(make-cover-annotate-top annotate-top))
;; -------- Annotation Helpers --------------
@ -168,21 +157,17 @@ The module implements code coverage annotations as described in cover.rkt
;; Syntax -> Natural
;; Maxiumum depth of begin-for-syntaxes
(define (get-syntax-depth expr [phase 0])
(kernel-syntax-case/phase
(disarm expr) phase
(define (get-syntax-depth expr)
(kernel-syntax-case
(disarm expr) #f
[(module _ _ mb)
(get-syntax-depth #'mb)]
[(module* _ _ mb)
(get-syntax-depth #'mb)]
[(begin-for-syntax b ...)
(add1 (apply max 1 (for/list ([b (in-list (syntax->list #'(b ...)))])
(get-syntax-depth b (add1 phase)))))]
[(define-syntaxes a ...)
2]
(add1 (apply max 1 (map get-syntax-depth (syntax->list #'(b ...)))))]
[(b ...)
(apply max 1 (for/list ([b (in-list (syntax->list #'(b ...)))])
(get-syntax-depth b phase)))]
(apply max 1 (map get-syntax-depth (syntax->list #'(b ...))))]
[_ 1]))
;; Natural PathString Symbol -> Syntax
@ -197,32 +182,17 @@ The module implements code coverage annotations as described in cover.rkt
[sync sync-name]
[file file]
[hash-ref hash-ref-name]
[#%papp app-name]
[#%papp #'#%app]
[pdefine-values #'define-values]
[pbegin begin-name]
[pbegin #'begin]
[prequire '#%require]
[pbegin-for-syntax bfs-name]
[send-name (format-symbol "~a~a" topic 'cover-internal-send-vector-mapping)]
[req-name (format-symbol "~a~a" topic 'cover-internal-request-vector-mapping)])
(define startup-code
#`(pbegin
(pdefine-values (lgr) (#%papp current-logger))
(pdefine-values (rec) (#%papp make-log-receiver lgr 'info 'send-name))
(pdefine-values (vector-name)
(pbegin
(#%papp log-message lgr 'info 'req-name '"" '#f)
(#%papp hash-ref
(#%papp unsafe-vector-ref
(#%papp sync rec)
'2)
'file)))))
#`(#,@(for/list ([i bfs-depth])
#`(#%require
(for-meta #,i (only '#%kernel quote))
(for-meta #,i (rename '#%kernel prequire #%require))))
#`(#%require (for-meta #,i (rename '#%kernel prequire #%require))))
#,@(for/list ([i bfs-depth])
#`(prequire (for-meta #,i (rename '#%kernel log-message log-message))
(for-meta #,i (rename '#%kernel pbegin-for-syntax begin-for-syntax))
#`(prequire (only '#%kernel quote)
(for-meta #,i (rename '#%kernel log-message log-message))
(for-meta #,i (rename '#%kernel current-logger current-logger))
(for-meta #,i (rename '#%kernel make-log-receiver make-log-receiver))
(for-meta #,i (rename '#%kernel sync sync))
@ -232,9 +202,16 @@ The module implements code coverage annotations as described in cover.rkt
(for-meta #,i (rename '#%kernel pbegin begin))
(for-meta #,i (rename '#%unsafe unsafe-vector-ref unsafe-vector-ref))
(for-meta #,i (rename '#%unsafe unsafe-vector-set! unsafe-vector-set!))))
(prequire (for-meta #,bfs-depth (rename '#%kernel pbegin begin)))
#,(for/fold ([stx #'(pbegin)]) ([i bfs-depth])
#`(pbegin #,startup-code (pbegin-for-syntax #,stx))))))
(pdefine-values (lgr) (#%papp current-logger))
(pdefine-values (rec) (#%papp make-log-receiver lgr 'info 'send-name))
(pdefine-values (vector-name)
(pbegin
(#%papp log-message lgr 'info 'req-name "" #f)
(#%papp hash-ref
(#%papp unsafe-vector-ref
(#%papp sync rec)
2)
file))))))
(define inspector (variable-reference->module-declaration-inspector
(#%variable-reference)))
@ -265,6 +242,7 @@ The module implements code coverage annotations as described in cover.rkt
;; -------- Generic `stacktrace^` Imports --------------
(define (with-mark src dest phase) dest)
(define test-coverage-enabled (make-parameter #t))
(define profile-key (gensym))
(define profiling-enabled (make-parameter #f))
(define initialize-profile-point void)

View File

@ -1,6 +0,0 @@
#lang racket/base
(require (for-meta 1 racket/base)
(for-meta 2 racket/base))
(begin-for-syntax (define-syntax x #f))

View File

@ -1,46 +1,2 @@
#lang racket
;; this is a comment
(+ 1 2)
(λ (x) 3)
(module+ test 20)
(λ (x) 3)
(module+ test 20)
(λ (x) 3)
(module+ test 20)
(begin-for-syntax
(require (for-syntax (only-in racket/base require for-syntax #%app begin-for-syntax #%datum only-in)))
;; this is a comment
(+ 1 2)
(λ (x) 3)
(module+ test1 20)
(λ (x) 3)
(module+ test1 20)
(λ (x) 3)
(module+ test1 20)
(begin-for-syntax
(require (only-in racket/base + λ module*))
(require (for-syntax (only-in racket/base require for-syntax #%app begin-for-syntax #%datum only-in)))
(+ 1 2)
(λ (x) 3)
(λ (x) 3)
(λ (x) 3)
(module* test2 racket 20)
(begin-for-syntax
(require (only-in racket/base + λ module*))
(require (for-syntax (only-in racket/base require for-syntax #%app begin-for-syntax #%datum only-in)))
(+ 1 2)
(λ (x) 3)
(λ (x) 3)
(λ (x) 3)
(module* test3 racket 20)
(begin-for-syntax
(require (only-in racket/base + λ module*))
(require (for-syntax (only-in racket/base require for-syntax #%app begin-for-syntax #%datum only-in)))
(+ 1 2)
(λ (x) 3)
(λ (x) 3)
(λ (x) 3)
(module* test4 racket 20)))))
(begin-for-syntax 1)

View File

@ -6,7 +6,6 @@
(define-runtime-path-list others
(list "bfs+module-nolex.rkt"
"bfs+module.rkt"
"bfs+define-syntax.rkt"
"lazy-require.rkt"))
(test-case
"begin-for-syntax with modules should be okay"

View File

@ -1,8 +1,11 @@
#lang racket
;; These tests modified from https://github.com/jackfirth/point-free
(provide arg-count
(provide define/compose
arg-count
define/arg-count)
(define-syntax-rule (define/compose id f ...)
(define id (compose f ...)))
(define-syntax-rule (arg-count n expr)
(lambda args

View File

@ -1,17 +1,14 @@
#lang info
#lang setup/infotab
(define name "cover")
(define collection 'multi)
(define version "3.1.1")
(define version "3.0.3")
(define deps '(("base" #:version "6.5.0.4") ("errortrace-lib" #:version "1.1")
"rackunit-lib" "syntax-color-lib" "compiler-lib"
"custom-load" "data-lib"))
(define deps '(("base" #:version "6.1.1") "errortrace-lib" "rackunit-lib"
"syntax-color-lib" "compiler-lib" "custom-load" "data-lib"))
(define build-deps
'("racket-doc" "scribble-lib" "typed-racket-doc" "htdp-lib"
"net-doc" "scribble-doc" "at-exp-lib" "scheme-lib" "typed-racket-lib"
"macro-debugger"))
(define pkg-authors '("spencer@florence.io"))