summaryrefslogtreecommitdiff
path: root/tests/projects/c++/modules
diff options
context:
space:
mode:
authorArthur LAURENT <[email protected]>2022-12-03 16:31:07 +0100
committerArthur LAURENT <[email protected]>2022-12-04 17:11:41 +0100
commit624490c743ac474ddca3c3cdb93a9fbff8e26dc5 (patch)
tree1eeecf76d24e91dd8b9f3f91c3067a00ab04c526 /tests/projects/c++/modules
parent49d732c29c8e97ad09fbf35effa1b7bdeda1c727 (diff)
add tests
Diffstat (limited to 'tests/projects/c++/modules')
-rw-r--r--tests/projects/c++/modules/msvc_internal_partition/src/hello.mpp9
-rw-r--r--tests/projects/c++/modules/msvc_internal_partition/src/hello_internal.mpp11
-rw-r--r--tests/projects/c++/modules/msvc_internal_partition/src/main.cpp6
-rw-r--r--tests/projects/c++/modules/msvc_internal_partition/test.lua1
-rw-r--r--tests/projects/c++/modules/msvc_internal_partition/xmake.lua6
-rw-r--r--tests/projects/c++/modules/test_msvc.lua18
6 files changed, 51 insertions, 0 deletions
diff --git a/tests/projects/c++/modules/msvc_internal_partition/src/hello.mpp b/tests/projects/c++/modules/msvc_internal_partition/src/hello.mpp
new file mode 100644
index 000000000..0966f029e
--- /dev/null
+++ b/tests/projects/c++/modules/msvc_internal_partition/src/hello.mpp
@@ -0,0 +1,9 @@
+export module hello;
+
+import :part_internal;
+
+export namespace hello {
+ void say(const char* str) {
+ say_internal(str);
+ }
+}
diff --git a/tests/projects/c++/modules/msvc_internal_partition/src/hello_internal.mpp b/tests/projects/c++/modules/msvc_internal_partition/src/hello_internal.mpp
new file mode 100644
index 000000000..8d0d4bee0
--- /dev/null
+++ b/tests/projects/c++/modules/msvc_internal_partition/src/hello_internal.mpp
@@ -0,0 +1,11 @@
+module;
+
+#include <cstdio>
+
+module hello:part_internal;
+
+namespace hello {
+ void say_internal(const char *str) {
+ printf("%s\n", str);
+ }
+} \ No newline at end of file
diff --git a/tests/projects/c++/modules/msvc_internal_partition/src/main.cpp b/tests/projects/c++/modules/msvc_internal_partition/src/main.cpp
new file mode 100644
index 000000000..1e5cc698f
--- /dev/null
+++ b/tests/projects/c++/modules/msvc_internal_partition/src/main.cpp
@@ -0,0 +1,6 @@
+import hello;
+
+int main() {
+ hello::say("hello module!");
+ return 0;
+}
diff --git a/tests/projects/c++/modules/msvc_internal_partition/test.lua b/tests/projects/c++/modules/msvc_internal_partition/test.lua
new file mode 100644
index 000000000..0657ead56
--- /dev/null
+++ b/tests/projects/c++/modules/msvc_internal_partition/test.lua
@@ -0,0 +1 @@
+inherit(".test_msvc")
diff --git a/tests/projects/c++/modules/msvc_internal_partition/xmake.lua b/tests/projects/c++/modules/msvc_internal_partition/xmake.lua
new file mode 100644
index 000000000..9c2063ebb
--- /dev/null
+++ b/tests/projects/c++/modules/msvc_internal_partition/xmake.lua
@@ -0,0 +1,6 @@
+add_rules("mode.release", "mode.debug")
+set_languages("c++20")
+target("msvc_internal_partition")
+ set_kind("binary")
+ add_files("src/*.cpp", "src/hello.mpp")
+ add_files("src/hello_internal.mpp", {values = {["msvc.internalpartition"] = true}})
diff --git a/tests/projects/c++/modules/test_msvc.lua b/tests/projects/c++/modules/test_msvc.lua
new file mode 100644
index 000000000..d51d3e3ef
--- /dev/null
+++ b/tests/projects/c++/modules/test_msvc.lua
@@ -0,0 +1,18 @@
+import("lib.detect.find_tool")
+import("core.base.semver")
+
+function _build()
+ local ci = (os.getenv("CI") or os.getenv("GITHUB_ACTIONS") or ""):lower()
+ if ci == "true" then
+ os.exec("xmake -rvD")
+ else
+ os.exec("xmake -r")
+ end
+end
+
+function main(t)
+ if is_subhost("windows") then
+ os.exec("xmake f -c")
+ _build()
+ end
+end