diff options
| author | Arthur LAURENT <[email protected]> | 2025-05-07 15:42:28 +0200 |
|---|---|---|
| committer | Arthur LAURENT <[email protected]> | 2025-05-09 15:56:33 +0200 |
| commit | b1578e624a53de98cbbbbf5a21ade120efdc5130 (patch) | |
| tree | b75d6bf52a0d2ef33661f85fd1889660ecbd322d /tests/projects/c++/modules/phony2 | |
| parent | 41bb46475576049e3b0dc6c008311c41d8432f62 (diff) | |
(C++ modules support) add tests
Diffstat (limited to 'tests/projects/c++/modules/phony2')
| -rw-r--r-- | tests/projects/c++/modules/phony2/include/foo.h | 1 | ||||
| -rw-r--r-- | tests/projects/c++/modules/phony2/src/hello.cpp | 17 | ||||
| -rw-r--r-- | tests/projects/c++/modules/phony2/src/hello.mpp | 16 | ||||
| -rw-r--r-- | tests/projects/c++/modules/phony2/src/main.cpp | 7 | ||||
| -rw-r--r-- | tests/projects/c++/modules/phony2/test.lua | 1 | ||||
| -rw-r--r-- | tests/projects/c++/modules/phony2/xmake.lua | 17 |
6 files changed, 59 insertions, 0 deletions
diff --git a/tests/projects/c++/modules/phony2/include/foo.h b/tests/projects/c++/modules/phony2/include/foo.h new file mode 100644 index 000000000..e66099202 --- /dev/null +++ b/tests/projects/c++/modules/phony2/include/foo.h @@ -0,0 +1 @@ +inline int foo() { return 5; } diff --git a/tests/projects/c++/modules/phony2/src/hello.cpp b/tests/projects/c++/modules/phony2/src/hello.cpp new file mode 100644 index 000000000..38ecf20e3 --- /dev/null +++ b/tests/projects/c++/modules/phony2/src/hello.cpp @@ -0,0 +1,17 @@ +module; + +#include <iostream> + +module hello; + +using namespace std; + +namespace hello { + say::say(int data) : data_(data) { + + } + + void say::hello() { + cout << "hello, say class: " << data_ << endl; + } +} // namespace hello diff --git a/tests/projects/c++/modules/phony2/src/hello.mpp b/tests/projects/c++/modules/phony2/src/hello.mpp new file mode 100644 index 000000000..6ddcc1d7f --- /dev/null +++ b/tests/projects/c++/modules/phony2/src/hello.mpp @@ -0,0 +1,16 @@ +module; + +#include <iostream> + +export module hello; + +export namespace hello { + class say { + public: + say(int data); + void hello(); + + private: + int data_; + }; +} // namespace hello diff --git a/tests/projects/c++/modules/phony2/src/main.cpp b/tests/projects/c++/modules/phony2/src/main.cpp new file mode 100644 index 000000000..6f80b6c7d --- /dev/null +++ b/tests/projects/c++/modules/phony2/src/main.cpp @@ -0,0 +1,7 @@ +import hello; + +int main() { + hello::say s(sizeof(hello::say)); + s.hello(); + return 0; +}
\ No newline at end of file diff --git a/tests/projects/c++/modules/phony2/test.lua b/tests/projects/c++/modules/phony2/test.lua new file mode 100644 index 000000000..7717f8049 --- /dev/null +++ b/tests/projects/c++/modules/phony2/test.lua @@ -0,0 +1 @@ +inherit(".test_base") diff --git a/tests/projects/c++/modules/phony2/xmake.lua b/tests/projects/c++/modules/phony2/xmake.lua new file mode 100644 index 000000000..3247ab41c --- /dev/null +++ b/tests/projects/c++/modules/phony2/xmake.lua @@ -0,0 +1,17 @@ +add_rules("mode.release", "mode.debug") +set_languages("c++20") + +target("test") + set_kind("static") + add_includedirs("include") + add_files("src/*.mpp", {public = true}) + +target("test-phony") + set_kind("phony") + add_deps("test") + +target("class") + set_kind("binary") + add_files("src/*.cpp") + add_deps("test-phony") + |
