[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
         racket/require-syntax
         rackunit/text-ui)

(provide (all-from-out rackunit)
         (all-from-out rackunit/text-ui)
         models-test
         my-model-test)

(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) ...)]))




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


Any ideas?

-- 
Eduardo Bellani

omnia mutantur, nihil interit.


Posted on the users mailing list.