Racket-mode (emacs) get coverage without using test submodule

52 views
Skip to first unread message

Julian

unread,
Oct 13, 2020, 3:53:52 PM10/13/20
to Racket Users
Hi,

For reasons X and Y that I won't get into I'm using Emacs instead of DrRacket for writing racket code for the Programming languages class that I'm taking. I have found that racket-mode (as recommended by https://docs.racket-lang.org/guide/Emacs.html) is able to do a lot of neat things and most of what I need to code.

The one limitation that I have run into is running my code and getting any kind of coverage information, whether that's visual highlighting or a printout in the REPL. At the moment I use DrRacket exclusively for this task. Back in the racket-mode Emacs world the closest thing that I have found is this:

However, this method not flexible enough since it requires me to put my tests in the following form, which differs from the test writing convention that I have to follow for this class:
(module+ test (require rackunit) (check-true #t))

I have heard that xrepl should be able to help me since I should be able to use
,coverage
but when I try to require it in the repl I get the following:

hw4.rkt> (require xrepl)
; hw4.rkt::424: Type Checker: missing type for top-level identifier;
;  either undefined or missing a type annotation
;   identifier: require
;   in: require
; Context:
;  /usr/racket/collects/syntax/private/id-table.rkt:454:11 free-id-table-ref
;  /usr/racket/collects/syntax/private/id-table.rkt:454:11 free-id-table-ref

The racket language I'm using is a custom teaching language (#lang pl 04) available here.

Does anyone have any ideas on how I could get coverage to work directly with racket-mode or with xrepl still inside of Emacs?

Background: I'm not experienced with Racket (only have knowledge of [B/I]SL languages and what I'm learning in this class) and I'm also not an Emacs wizard.

Thanks for the help.
- Julian

Greg Hendershott

unread,
Oct 20, 2020, 9:29:57 AM10/20/20
to Racket Users
Racket Mode was recently enhanced in this neighborhood:


If you upgrade it and that works for you, great.

If not feel free to open a GitHub issue about it. (Right now I'm not really able to download that pl.plt file and try it myself.)
Reply all
Reply to author
Forward
0 new messages