From 7e4586dd6fcdb388fedbe6fe7d83ceaa19bd5039 Mon Sep 17 00:00:00 2001 From: Spencer Florence Date: Wed, 14 Jan 2015 20:54:41 -0500 Subject: [PATCH] Adding and friends a la #27 --- cover.rkt | 6 +++--- private/coveralls.rkt | 10 +++++----- private/format-utils.rkt | 2 +- raco.rkt | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cover.rkt b/cover.rkt index bd7dea2..d69752d 100644 --- a/cover.rkt +++ b/cover.rkt @@ -23,7 +23,7 @@ (define (test-files! #:submod [submod-name 'test] . paths) (unless ns (unloaded-error)) (define abs - (for/list ([p paths]) + (for/list ([p (in-list paths)]) (if (list? p) (cons (->absolute (car p)) (cdr p)) (->absolute p)))) @@ -35,7 +35,7 @@ [current-output-port (if (verbose) (current-output-port) (open-output-nowhere))]) (define tests-failed #f) - (for ([p paths]) + (for ([p (in-list paths)]) (vprintf "attempting to run ~s\n" p) (define old-check (current-check-handler)) (define path (if (list? p) (car p) p)) @@ -129,7 +129,7 @@ ;; remove those that cannot be annotated (define can-annotate (filter values - (for/list ([(stx covered?) (get-raw-coverage)]) + (for/list ([(stx covered?) (in-hash (get-raw-coverage))]) (and (syntax? stx) (let* ([orig-src (syntax-source stx)] [src (if (path? orig-src) (path->string orig-src) orig-src)] diff --git a/private/coveralls.rkt b/private/coveralls.rkt index a680ebb..524db22 100644 --- a/private/coveralls.rkt +++ b/private/coveralls.rkt @@ -112,7 +112,7 @@ ;; Generates a string that represents a valid coveralls json_file object (define (generate-source-files coverage) (define src-files - (for/list ([file (hash-keys coverage)]) + (for/list ([file (in-list (hash-keys coverage))]) (define local-file (path->string (find-relative-path (current-directory) file))) (define src (file->string file)) (define c (line-coverage coverage file)) @@ -154,7 +154,7 @@ [else (json-null)])) (define-values (line-cover _) - (for/fold ([coverage '()] [count 1]) ([line split-src]) + (for/fold ([coverage '()] [count 1]) ([line (in-list split-src)]) (cond [(zero? (string-length line)) (values (cons (json-null) coverage) (add1 count))] [else (define nw-count (+ count (string-length line) 1)) (define all-covered (foldr process-coverage 'irrelevant (range count nw-count))) @@ -195,7 +195,7 @@ (define (parse-git-remote raw) (define lines (string-split raw "\n")) (define fetch-only (filter (λ (line) (regexp-match #rx"\\(fetch\\)" line)) lines)) - (for/list ([line fetch-only]) + (for/list ([line (in-list fetch-only)]) (define split (string-split line)) (hasheq 'name (list-ref split 0) 'url (list-ref split 1)))) @@ -212,6 +212,6 @@ (define command (string-append "git --no-pager log -1 --pretty=format:" format)) (define log (with-output-to-string (thunk (system command)))) (define lines (string-split log "\n")) - (for/hasheq ([field '(id author_name author_email committer_name committer_email message)] - [line lines]) + (for/hasheq ([field (in-list '(id author_name author_email committer_name committer_email message))] + [line (in-list lines)]) (values field line))) diff --git a/private/format-utils.rkt b/private/format-utils.rkt index bd69e5d..d0362cd 100644 --- a/private/format-utils.rkt +++ b/private/format-utils.rkt @@ -49,7 +49,7 @@ (define irrelevant? (make-irrelevant? lexer f)) (define file-length (string-length (file->string f))) (define cache - (for/hash ([i (range 1 (add1 file-length))]) + (for/hash ([i (in-range 1 (add1 file-length))]) (values i (cond [(irrelevant? i) 'irrelevant] [else (raw-covered? i c)])))) diff --git a/raco.rkt b/raco.rkt index d98f0cf..fea0d0d 100644 --- a/raco.rkt +++ b/raco.rkt @@ -136,7 +136,7 @@ (define full-argv (append expanded-argv args)) (if (should-omit? (current-directory) full-omits) null - (for/list ([p (directory-list)]) + (for/list ([p (in-list (directory-list))]) (cond [(directory-exists? p) (parameterize ([current-directory (build-path (current-directory) p)]) (expand-directory exts full-omits full-argv))] @@ -189,7 +189,7 @@ ;; Coverage -> Coverage (define (remove-excluded-paths cover paths) - (for/hash ([(k v) cover] + (for/hash ([(k v) (in-hash cover)] #:unless (is-excluded-path? k paths)) (values k v)))