Debian Codegraph @

lib/compat/r7rs-srfi-tests.scm

raw
1 ;;;
2 ;;; compat.r7rs-srfi-tests
3 ;;;
4 ;;; This is a simple adapter to run test written in r7rs define-library
5 ;;; form in Gauche without loading r7rs.
6 ;;;
7 ;;; What it does is basically redefining define-library locally to extract
8 ;;; expressions in 'begin', with ignoring other library declarations.
9 ;;; Necessary setup (e.g. imports) must be done in the caller side.
10 ;;;
11 ;;; The reason we need this is that we run srfi tests _before_ testing full
12 ;;; r7rs functionality, so we don't want to load r7rs in order to test given
13 ;;; srfi tests. So far, most of r7rs srfi tests doesn't use elaborated r7rs
14 ;;; features, and simple adapter suffices our purpose. (If the test does
15 ;;; require full r7rs features, it must be tested after r7rs tests.)
16 ;;;
17
18 (define-module compat.r7rs-srfi-tests
19 (export define-library))
20 (select-module compat.r7rs-srfi-tests)
21
22 (define-syntax define-library
23 (er-macro-transformer
24 (^[f r c]
25 (find (^[form] (and (pair? form) (c (r'begin) (car form))))
26 (cddr f)))))