From e7fd8ff58b401a5803752f2e8780c51a6d7e7ca6 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Sat, 5 Dec 2020 10:53:54 -0800 Subject: [PATCH] test for multiple imports in 1 statement --- tests/privateimports/mt8.nim | 19 +++++++++++++++++++ tests/privateimports/tmain.nim | 4 +++- 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 tests/privateimports/mt8.nim diff --git a/tests/privateimports/mt8.nim b/tests/privateimports/mt8.nim new file mode 100644 index 0000000000000..acb9288ffee11 --- /dev/null +++ b/tests/privateimports/mt8.nim @@ -0,0 +1,19 @@ +#[ +test multiple imports +]# + +{.push experimental: "allowPrivateImport".} +import ./m1, m2 {.privateImport.}, ./m3 {.privateImport.} + +# m1 is regularly imported +doAssert declared(m1.foo0) +doAssert declared(foo0) +doAssert not declared(m1.foo1) + +# m2 +doAssert declared(m2.bar2) +doAssert declared(bar2) + +# m3 +doAssert declared(m3.car2) +doAssert declared(car2) diff --git a/tests/privateimports/tmain.nim b/tests/privateimports/tmain.nim index 9ac36cf1974f6..b76d9bbe72d86 100644 --- a/tests/privateimports/tmain.nim +++ b/tests/privateimports/tmain.nim @@ -1 +1,3 @@ -import "."/[mt0,mt1,mt2,mt3,mt4,mt4b,mt5,mt6,mt7] \ No newline at end of file +{.warning[UnusedImport]: off.} +# only import `mt*.nim` here; these depend on `m*.nim` +import "."/[mt0,mt1,mt2,mt3,mt4,mt4b,mt5,mt6,mt7,mt8]