マクロ云々

というエントリを入れたら TB が来た。

現状では以下なカンジになっているらしい。

(define-syntax f-test
  (syntax-rules (=>)
    ((_ (f (=> a args ...) ...) ...)
     (let-syntax
         ((eqt (syntax-rules ()
                 ((_ expr expected)
                  (test* (quote expr) expected expr)))))
       (begin
         (test-section (symbol->string (quote f)))
         (eqt (f args ...) a) ...) ...))
    ((_ (f (args rest ...) ...) ...)
     (begin (f-test (f (rest ... args) ...)) ...))))

で試験なコードが以下。

(test-start "chapter 3")
(f-test
 (rember ['mint '(lamb chops and mint jelly) => '(lamb chops and jelly)]
         ['mint '(lamb chops and mint flavored mint jelly)
                => '(lamb chops and flavored mint jelly)]
         ['toast '(bacon lettuce and tomato) => '(bacon lettuce and tomato)]
         ['cup '(coffee cup tea cup and hick cup)
               => '(coffee tea cup and hick cup)]
         ['bacon '(bacon lettuce and tomato) => '(lettuce and tomato)]
         ['and '(bacon lettuce and tomato) => '(bacon lettuce tomato)]
         ['sauce '(soy sauce and tomato sauce) => '(soy and tomato sauce)])
)

ここまでヤるとアレな気もしますが凄いな。
わしはあまりこの syntax-rules 関連が得意ではないので定義をかを見てもすぐ直感的にイメージできないあたりが微妙なんですが、やっぱ ext/charconf/test.scm をいっしょに読んだ方が良さげな気がしてたり。