Created
July 27, 2016 19:52
-
-
Save schuster/9a469816d32e925ab65c2a1ee2e9847b to your computer and use it in GitHub Desktop.
Wrong location reported by test macro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(require | |
rackunit | |
(for-syntax syntax/parse)) | |
(define-simple-check (check-foo? actual) | |
(equal? actual 'foo)) | |
(define-syntax (test-foo? stx) | |
(syntax-parse stx | |
[(_ name actual) | |
(syntax/loc stx | |
(test-case name (check-foo? actual)))])) | |
(test-foo? "test 1" 'a) | |
(test-case "test 2" (check-foo? 'b)) | |
#| Output: | |
-------------------- | |
test 1 | |
FAILURE | |
name: check-foo? | |
location: (#<path:/home/schu/tmp/rackunit-loc-test.rkt> 15 23 247 19) | |
expression: (check-foo? 'a) | |
params: (a) | |
. Check failure | |
-------------------- | |
-------------------- | |
test 2 | |
FAILURE | |
name: check-foo? | |
location: (#<path:/home/schu/tmp/rackunit-loc-test.rkt> 19 20 318 15) | |
expression: (check-foo? 'b) | |
params: (b) | |
. Check failure | |
-------------------- | |
|# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment