From 5c0286dd6ec8c3f8bf7e6c4e7cecd9d5903948e8 Mon Sep 17 00:00:00 2001 From: ruki Date: Fri, 6 Sep 2019 22:48:20 +0800 Subject: add impl_unit tests --- tests/projects/c++/modules/impl_unit/src/hello.mpp | 10 ++++++++++ .../projects/c++/modules/impl_unit/src/hello_impl.cpp | 19 +++++++++++++++++++ tests/projects/c++/modules/impl_unit/src/main.cpp | 8 ++++++++ tests/projects/c++/modules/impl_unit/xmake.lua | 5 +++++ 4 files changed, 42 insertions(+) create mode 100644 tests/projects/c++/modules/impl_unit/src/hello.mpp create mode 100644 tests/projects/c++/modules/impl_unit/src/hello_impl.cpp create mode 100644 tests/projects/c++/modules/impl_unit/src/main.cpp create mode 100644 tests/projects/c++/modules/impl_unit/xmake.lua (limited to 'tests/projects/c++/modules') diff --git a/tests/projects/c++/modules/impl_unit/src/hello.mpp b/tests/projects/c++/modules/impl_unit/src/hello.mpp new file mode 100644 index 000000000..0b65bf24e --- /dev/null +++ b/tests/projects/c++/modules/impl_unit/src/hello.mpp @@ -0,0 +1,10 @@ +export module hello; + +namespace hello { + void say_hi(); +} + +export namespace hello { + void say_hello(); + void say_xz(); +} \ No newline at end of file diff --git a/tests/projects/c++/modules/impl_unit/src/hello_impl.cpp b/tests/projects/c++/modules/impl_unit/src/hello_impl.cpp new file mode 100644 index 000000000..1c9968a51 --- /dev/null +++ b/tests/projects/c++/modules/impl_unit/src/hello_impl.cpp @@ -0,0 +1,19 @@ +// module; +#include +module hello; + +using namespace std; + +namespace hello { + void say_hi() { + cout << "hello hi!" << endl; + } + + void say_hello() { + cout << "hello world!" << endl; + } + + void say_xz() { + cout << "hello xz!" << endl; + } +} diff --git a/tests/projects/c++/modules/impl_unit/src/main.cpp b/tests/projects/c++/modules/impl_unit/src/main.cpp new file mode 100644 index 000000000..378861561 --- /dev/null +++ b/tests/projects/c++/modules/impl_unit/src/main.cpp @@ -0,0 +1,8 @@ +import hello; + +int main() { + hello::say_hello(); + hello::say_xz(); + // hello::say_hi(); + return 0; +} \ No newline at end of file diff --git a/tests/projects/c++/modules/impl_unit/xmake.lua b/tests/projects/c++/modules/impl_unit/xmake.lua new file mode 100644 index 000000000..1ce6cb8b6 --- /dev/null +++ b/tests/projects/c++/modules/impl_unit/xmake.lua @@ -0,0 +1,5 @@ +target("impl_unit") + set_kind("binary") + add_files("src/*.cpp", "src/*.mpp") + + -- cgit v1.3.1