aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test/examples/boost
diff options
context:
space:
mode:
Diffstat (limited to 'test/examples/boost')
-rw-r--r--test/examples/boost/CMakeLists.txt12
-rw-r--r--test/examples/boost/foo.cpp13
-rw-r--r--test/examples/boost/run.ps124
3 files changed, 49 insertions, 0 deletions
diff --git a/test/examples/boost/CMakeLists.txt b/test/examples/boost/CMakeLists.txt
new file mode 100644
index 0000000..0e92e38
--- /dev/null
+++ b/test/examples/boost/CMakeLists.txt
@@ -0,0 +1,12 @@
+cmake_minimum_required(VERSION 3.15)
+
+project(example_boost)
+
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+find_package(Boost REQUIRED COMPONENTS filesystem)
+add_executable(foo foo.cpp)
+target_link_libraries(foo PRIVATE Boost::disable_autolinking Boost::filesystem)
+
+install(TARGETS foo RUNTIME DESTINATION bin)
diff --git a/test/examples/boost/foo.cpp b/test/examples/boost/foo.cpp
new file mode 100644
index 0000000..6219e68
--- /dev/null
+++ b/test/examples/boost/foo.cpp
@@ -0,0 +1,13 @@
+#include <boost/filesystem.hpp>
+
+#include <iostream>
+
+int main(int argc, char* argv[]) {
+ namespace fs = boost::filesystem;
+ std::cout << argv[0] << '\n';
+ for (int i = 1; i < argc; ++i) {
+ std::cout << fs::absolute(boost::filesystem::path{argv[i]}).string()
+ << '\n';
+ }
+ return 0;
+}
diff --git a/test/examples/boost/run.ps1 b/test/examples/boost/run.ps1
new file mode 100644
index 0000000..578911f
--- /dev/null
+++ b/test/examples/boost/run.ps1
@@ -0,0 +1,24 @@
+param(
+ [Parameter(Mandatory=$true)]
+ [string] $FooPath
+)
+
+$foo_path = [System.IO.Path]::GetFullPath($FooPath)
+if ($IsWindows) {
+ $foo_path += '.exe'
+}
+
+$relative = 'test.txt'
+$absolute = Join-Path (Get-Location).Path $relative
+
+$actual = & $foo_path $relative
+echo 'Actual output:'
+echo $actual
+
+$expected = $foo_path,$absolute
+echo 'Expected output:'
+echo $expected
+
+if (Compare-Object $actual $expected -CaseSensitive) {
+ throw 'Unexpected output'
+}