diff options
| author | Arthur LAURENT <[email protected]> | 2024-04-03 03:52:29 +0200 |
|---|---|---|
| committer | Arthur LAURENT <[email protected]> | 2024-04-03 04:50:26 +0200 |
| commit | 13b1dda53dfe34b24982f1f3c436a860fd257aa1 (patch) | |
| tree | 1c09d6eeab266a9c528adc94824a0f3d5c8ab661 /tests/projects/c++ | |
| parent | 6e061abc8d3a1154001708e85ff50d76ff21f6f7 (diff) | |
add test
fix test indent
Diffstat (limited to 'tests/projects/c++')
7 files changed, 78 insertions, 0 deletions
diff --git a/tests/projects/c++/snippet_runtimes/my-repo/packages/b/bar/src/include/bar.hpp b/tests/projects/c++/snippet_runtimes/my-repo/packages/b/bar/src/include/bar.hpp new file mode 100644 index 000000000..e712aebe0 --- /dev/null +++ b/tests/projects/c++/snippet_runtimes/my-repo/packages/b/bar/src/include/bar.hpp @@ -0,0 +1,8 @@ +#ifndef BAR_HPP +#define BAR_HPP + +#include <string> + +std::string foo(); + +#endif diff --git a/tests/projects/c++/snippet_runtimes/my-repo/packages/b/bar/src/src/bar.cpp b/tests/projects/c++/snippet_runtimes/my-repo/packages/b/bar/src/src/bar.cpp new file mode 100644 index 000000000..1dc99de3c --- /dev/null +++ b/tests/projects/c++/snippet_runtimes/my-repo/packages/b/bar/src/src/bar.cpp @@ -0,0 +1,5 @@ +#include <bar.hpp> + +std::string foo() { + return "bar"; +} diff --git a/tests/projects/c++/snippet_runtimes/my-repo/packages/b/bar/src/xmake.lua b/tests/projects/c++/snippet_runtimes/my-repo/packages/b/bar/src/xmake.lua new file mode 100644 index 000000000..8393aed87 --- /dev/null +++ b/tests/projects/c++/snippet_runtimes/my-repo/packages/b/bar/src/xmake.lua @@ -0,0 +1,6 @@ +target("bar") + set_kind("$(kind)") + add_files("src/*.cpp") + add_headerfiles("include/(**.hpp)") + add_includedirs("include") + diff --git a/tests/projects/c++/snippet_runtimes/my-repo/packages/b/bar/xmake.lua b/tests/projects/c++/snippet_runtimes/my-repo/packages/b/bar/xmake.lua new file mode 100644 index 000000000..173fc1427 --- /dev/null +++ b/tests/projects/c++/snippet_runtimes/my-repo/packages/b/bar/xmake.lua @@ -0,0 +1,15 @@ +package("bar") + set_sourcedir(path.join(os.scriptdir(), "src")) + + on_install(function(package) + import("package.tools.xmake").install(package, {}) + end) + + on_test(function(package) + assert(package:check_cxxsnippets({test = [[ + #include <iostream> + void test() { + std::cout << _LIBCPP_VERSION << std::endl; + } + ]]}, {configs = {languages = "c++17"}})) + end) diff --git a/tests/projects/c++/snippet_runtimes/src/main.cpp b/tests/projects/c++/snippet_runtimes/src/main.cpp new file mode 100644 index 000000000..1c8e6bf02 --- /dev/null +++ b/tests/projects/c++/snippet_runtimes/src/main.cpp @@ -0,0 +1,7 @@ +#include <iostream> +#include <bar.hpp> + +int main() { + std::cout << foo(); + return 0; +} diff --git a/tests/projects/c++/snippet_runtimes/test.lua b/tests/projects/c++/snippet_runtimes/test.lua new file mode 100644 index 000000000..753cab958 --- /dev/null +++ b/tests/projects/c++/snippet_runtimes/test.lua @@ -0,0 +1,19 @@ +import("lib.detect.find_tool") +import("core.base.semver") +import("utils.ci.is_running", {alias = "ci_is_running"}) + +function _build() + if ci_is_running() then + assert(os.iorun("xmake -rvD")) + else + assert(os.iorun("xmake -r")) + end +end + +function main(t) + local clang = find_tool("clang") + if clang and not is_subhost("windows") then + os.exec("xmake f --toolchain=clang --runtimes=c++_shared --yes") + _build() + end +end diff --git a/tests/projects/c++/snippet_runtimes/xmake.lua b/tests/projects/c++/snippet_runtimes/xmake.lua new file mode 100644 index 000000000..1e5436ba4 --- /dev/null +++ b/tests/projects/c++/snippet_runtimes/xmake.lua @@ -0,0 +1,18 @@ +add_repositories("my-repo my-repo") +add_requires("bar") + +target("foo") + set_kind("binary") + add_files("src/*.cpp") + + add_packages("bar") + + on_config(function(target) + assert(target:check_cxxsnippets({test = [[ + #include <iostream> + void test() { + std::cout << _LIBCPP_VERSION << std::endl; + } + ]]}, {configs = {languages = "c++17"}})) + end) + |
