Add a test suite for the syntax collect.

This commit is contained in:
Vincent St-Amour 2011-07-05 15:06:24 -04:00
parent b25ee81d79
commit 669523477a
2 changed files with 38 additions and 0 deletions

View File

@ -0,0 +1,18 @@
#lang racket/base
(require rackunit rackunit/text-ui racket/runtime-path)
;; Runs all the files in the tests subdirectory.
;; A test fails if it throws an exception.
(define-runtime-path tests-dir "./tests")
(define tests
(make-test-suite
"syntax tests"
(for/list ([t (in-directory tests-dir)])
(test-suite
(path->string t)
(check-not-exn (lambda () (dynamic-require t #f)))))))
(run-tests tests)

View File

@ -0,0 +1,20 @@
#lang racket
(require (for-syntax racket/struct-info racket/match))
(define-signature sig2^
((struct my-error (v))))
(define-unit a-unit@
(import)
(export sig2^)
(define-struct my-error (v)))
(define-values/invoke-unit/infer a-unit@)
(begin-for-syntax
struct-info?
(match (extract-struct-info (syntax-local-value #'my-error))
[(list str m1 m? sels sets _)
(unless (= (length sels) (length sets))
(error "not the same number of selectors and setters"))]))