[racket] Require macros

From: Eduardo Bellani (ebellani at gmail.com)
Date: Tue Jan 11 11:08:28 EST 2011

Hello list.

I am having a bit of a pain with trying to create a custom require
syntax. I am trying to save some typing in an MVC like application by
building some macros to recognize in the test files where the files to
be tested are.

I have 2 doubts I think, one is how to retrieve the module name for the
my-model-test macro and the other is how to make those macros work in
in the require form as the target-test.rkt file tries to do.

BTW, I have looked at the require Macros section of the docs, but so far
to no avail.

For illustration, here is my (broken) code:

;; auxiliary.rkt
#lang racket

(require rackunit

(provide (all-from-out rackunit)
         (all-from-out rackunit/text-ui)

(define-syntax my-model-test
  (syntax-rules ()
     (string-append "../app/model/" *MODULE-NAME*)]))

(define-syntax models-test
  (syntax-rules ()
    [(_ model-name ...)
     (values (string-append "../app/model/" model-name) ...)]))

(require "../auxiliary.rkt"
         (model-test "a-model")

Any ideas?

Eduardo Bellani

omnia mutantur, nihil interit.

Posted on the users mailing list.