Re: [racket-users] A convenient assertion macro - with one caveat

2020-05-07 Thread Dexter Lagan
Awesome! Thanks. Racket is freaking amazing. Dex > On May 7, 2020, at 11:51 AM, Jens Axel Søgaard wrote: > >  > You can use syntax/loc to give a piece of syntax location information. > > #lang racket > (require (for-syntax syntax/parse)) > > (define-syntax (assert stx) > (syntax-parse stx

Re: [racket-users] A convenient assertion macro - with one caveat

2020-05-07 Thread Jens Axel Søgaard
You can use syntax/loc to give a piece of syntax location information. #lang racket (require (for-syntax syntax/parse)) (define-syntax (assert stx) (syntax-parse stx [(_assert ?a ?b) (quasisyntax/loc stx (module+ test (require rackunit) #,(syntax/loc stx

Re: [racket-users] A convenient assertion macro - with one caveat

2020-05-07 Thread Laurent
Check out `make-check-location` and friends, and maybe `with-check-info*` https://docs.racket-lang.org/rackunit/api.html?q=define-check#%28def._%28%28lib._rackunit%2Fmain..rkt%29._make-check-location%29%29 You may have to combine with the syntax-information extracted from the syntax object `stx`.

[racket-users] A convenient assertion macro - with one caveat

2020-05-07 Thread Dexter Lagan
Hi, I made a simple macro which saves me the trouble of defining a test module, requiring RackUnit and then declaring '(module+ test' after each procedure definition, as I like to keep unit tests close by. The repo : https://github.com/DexterLagan/assert Here's the macro, apologies for the