Here's a macro that uses with-check-info* to set a check's location relative to its argument.
#lang racket/base
(require rackunit (for-syntax racket/base syntax/parse syntax/srcloc))
(define-syntax (check-true* stx)
(syntax-parse stx
[(_ . e*)
#`(begin .
#,(for/list ([e (in-list (syntax-e #'e*))])
#`(with-check-info* (list (make-check-location '#,(build-source-location-list e)))
(λ () (check-true #,e)))))]))
(check-true*
#true
#false)
Running this on HEAD prints an error with 2 location:s
--------------------
FAILURE
location: test.rkt:14:1
name: check-true
location: test.rkt:10:22
params: '(#f)
--------------------
Running on 6.5 prints only one:
--------------------
FAILURE
name: check-true
expression: (check-true #f)
params: (#f)
location: (#<path:/Users/ben/code/racket/gtp/shallow/model/test.rkt> 14 1 387 6)
Check failure
--------------------
Should I change my macro?
Here's a macro that uses
with-check-info*to set a check's location relative to its argument.Running this on HEAD prints an error with 2
location:sRunning on 6.5 prints only one:
Should I change my macro?