diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2020-11-18 08:00:16 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2020-11-19 13:00:11 +0200 |
commit | 6a2d1e3062964fc16cfbc43bc69284f854c35dca (patch) | |
tree | 33b10d64adaa01d6afd58f121cb77bdde53d4116 /libbuild2/cc/parser+module.test.testscript | |
parent | f91468192ad7066a5e6fa63ddc4e4231e632a457 (diff) |
Handle C++20 module partitions in scanner
Diffstat (limited to 'libbuild2/cc/parser+module.test.testscript')
-rw-r--r-- | libbuild2/cc/parser+module.test.testscript | 51 |
1 files changed, 41 insertions, 10 deletions
diff --git a/libbuild2/cc/parser+module.test.testscript b/libbuild2/cc/parser+module.test.testscript index e4ec139..5afb0b1 100644 --- a/libbuild2/cc/parser+module.test.testscript +++ b/libbuild2/cc/parser+module.test.testscript @@ -7,6 +7,30 @@ # NOTE: currently header unit imports don't produce anything. # +: module-iface +: +$* <<EOI >>EOI +export module foo; +EOI + +: module-impl +: +$* <<EOI >>EOI +module foo; +EOI + +: module-iface-part +: +$* <<EOI >>EOI +export module foo:part; +EOI + +: module-impl-part +: +$* <<EOI >>EOI +module foo.bar:part.sub; +EOI + : import : $* <<EOI >>EOI @@ -23,16 +47,12 @@ import <sys/foo.h>; __import "/usr/include/stdio.h"; EOI -: module-implementation +: import-part : $* <<EOI >>EOI module foo; -EOI - -: module-interface -: -$* <<EOI >>EOI -export module foo; +import :part; +import :part.sub; EOI : export-imported @@ -54,6 +74,7 @@ export import(*a); import::inner xi = {}; ::import <a>; class import<int>; +import ::x; EOI : non-module @@ -72,12 +93,12 @@ EOI : attribute : $* <<EOI >>EOO +module bar [[module({module})]]; import foo [[export({import})]]; import "foo.h" [[export({import})]]; -module bar [[module({module})]]; EOI -import foo; module bar; +import foo; EOO : import-duplicate @@ -92,6 +113,16 @@ import foo; import bar.baz; EOO +: part-out-purview +: +$* <<EOI 2>>EOE != 0 +module; +import :part +module foo; +EOI +<stdin>:2:8: error: partition importation out of module purview +EOE + : brace-missing : $* <<EOI 2>>EOE @@ -125,7 +156,7 @@ EOE $* <<EOI 2>>EOE != 0 module ; EOI -<stdin>:1:1: error: module declaration expected after leading module marker +<stdin>:1:1: error: module declaration expected after global module fragment EOE : import-missing-semi |