And now with reexport-m9.scm and reexport-m10.scm
From ab6b7e798151e8af2d987e91acdf86f98f0251f4 Mon Sep 17 00:00:00 2001
From: Peter Bex <pe...@more-magic.net>
Date: Sun, 1 Aug 2021 15:35:44 +0200
Subject: [PATCH] Add regression test for #1771

This bug was fixed by the fix for #1772, but this was supposed to only
be a performance improvement, so the fix was "accidental" (and,
accordingly, there was no change to the test suite).  Therefore it's a
good idea to add a regression test.
---
 NEWS                       | 2 ++
 distribution/manifest      | 2 ++
 tests/reexport-m10.scm     | 3 +++
 tests/reexport-m9.scm      | 6 ++++++
 tests/reexport-tests-2.scm | 5 +++++
 tests/runtests.bat         | 4 ++++
 tests/runtests.sh          | 2 ++
 7 files changed, 24 insertions(+)
 create mode 100644 tests/reexport-m10.scm
 create mode 100644 tests/reexport-m9.scm

diff --git a/NEWS b/NEWS
index 899ddb2f..91507e1d 100644
--- a/NEWS
+++ b/NEWS
@@ -36,6 +36,8 @@
 - Module system
   - Reexported macros now work when the reexporting module redefines
     identifiers from the original (fixes #1757, reported by Sandra Snan).
+  - When using "except" in "import" to omit reexported macros,
+    they are really not imported (#1771, reported by Sandra Snan).
 
 - Runtime system
   - Sleeping primordial thread doesn't forget mutations made to
diff --git a/distribution/manifest b/distribution/manifest
index 53aeaa4f..00a8c515 100644
--- a/distribution/manifest
+++ b/distribution/manifest
@@ -198,6 +198,8 @@ tests/reexport-m5.scm
 tests/reexport-m6.scm
 tests/reexport-m7.scm
 tests/reexport-m8.scm
+tests/reexport-m9.scm
+tests/reexport-m10.scm
 tests/reexport-tests.scm
 tests/reexport-tests-2.scm
 tests/ec.scm
diff --git a/tests/reexport-m10.scm b/tests/reexport-m10.scm
new file mode 100644
index 00000000..f485bad2
--- /dev/null
+++ b/tests/reexport-m10.scm
@@ -0,0 +1,3 @@
+(module reexport-m10 ()
+  (import (only reexport-m9 define) (chicken module))
+  (reexport (only reexport-m9 define)))
diff --git a/tests/reexport-m9.scm b/tests/reexport-m9.scm
new file mode 100644
index 00000000..8bc3a425
--- /dev/null
+++ b/tests/reexport-m9.scm
@@ -0,0 +1,6 @@
+(module reexport-m9 (define)
+  (import (only scheme define-syntax syntax-rules) (only (chicken base) error))
+  (define-syntax define
+    (syntax-rules ()
+      ((_ a b)
+       (error "wrong define!")))))
diff --git a/tests/reexport-tests-2.scm b/tests/reexport-tests-2.scm
index fbaad6cf..8f57808b 100644
--- a/tests/reexport-tests-2.scm
+++ b/tests/reexport-tests-2.scm
@@ -11,3 +11,8 @@
 (import reexport-m8)
 (assert (equal? '(d c b a) (reexported-reverse '(a b c d))))
 (assert (equal? '(d c b a) (reexported-local-reverse '(a b c d))))
+
+;; Regression test for #1771 where reexports would get ignored by
+;; "except" specifier.
+(import (except reexport-m10 define))
+(define something 1) ;; If reexport messed up, this would be syntax from reexport-m9 expanding to (error ...)
diff --git a/tests/runtests.bat b/tests/runtests.bat
index b696899c..8411ec72 100644
--- a/tests/runtests.bat
+++ b/tests/runtests.bat
@@ -334,6 +334,10 @@ if errorlevel 1 exit /b 1
 if errorlevel 1 exit /b 1
 %compile_s% reexport-m8.scm -J
 if errorlevel 1 exit /b 1
+%compile_s% reexport-m9.scm -J
+if errorlevel 1 exit /b 1
+%compile_s% reexport-m10.scm -J
+if errorlevel 1 exit /b 1
 %compile% reexport-tests-2.scm
 if errorlevel 1 exit /b 1
 a.out
diff --git a/tests/runtests.sh b/tests/runtests.sh
index 11503b3c..e7dd37b3 100755
--- a/tests/runtests.sh
+++ b/tests/runtests.sh
@@ -264,6 +264,8 @@ $compile_s reexport-m5.scm -J
 $compile_s reexport-m6.scm -J
 $compile_s reexport-m7.scm -J
 $compile_s reexport-m8.scm -J
+$compile_s reexport-m9.scm -J
+$compile_s reexport-m10.scm -J
 $compile reexport-tests-2.scm
 ./a.out
 
-- 
2.20.1

Attachment: signature.asc
Description: PGP signature

Reply via email to