Skip to content

Instantly share code, notes, and snippets.

@schuster
Created July 27, 2016 19:52
Show Gist options
  • Save schuster/9a469816d32e925ab65c2a1ee2e9847b to your computer and use it in GitHub Desktop.
Save schuster/9a469816d32e925ab65c2a1ee2e9847b to your computer and use it in GitHub Desktop.
Wrong location reported by test macro
#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