From 669523477a6db6ffd09be5c63b2281c6def31178 Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Tue, 5 Jul 2011 15:06:24 -0400 Subject: [PATCH] Add a test suite for the syntax collect. --- collects/tests/syntax/run.rkt | 18 ++++++++++++++++++ collects/tests/syntax/tests/pr12017.rkt | 20 ++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 collects/tests/syntax/run.rkt create mode 100644 collects/tests/syntax/tests/pr12017.rkt diff --git a/collects/tests/syntax/run.rkt b/collects/tests/syntax/run.rkt new file mode 100644 index 0000000000..21fc1bfd1e --- /dev/null +++ b/collects/tests/syntax/run.rkt @@ -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) diff --git a/collects/tests/syntax/tests/pr12017.rkt b/collects/tests/syntax/tests/pr12017.rkt new file mode 100644 index 0000000000..012ae91927 --- /dev/null +++ b/collects/tests/syntax/tests/pr12017.rkt @@ -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"))]))