aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-05-19 21:19:58 +0300
committerBoris Kolpackov <boris@codesynthesis.com>2020-06-26 15:29:51 +0200
commit0b69165d4c681e645b6b44dec29cefeaae6849d9 (patch)
tree957f1888a555431a4fc028c34bd2611f4c15388a
parentaf85a3694788ca5c9e5a9e6f525e4934ed5eb64c (diff)
Add test for optional class template
-rw-r--r--tests/optional/buildfile6
-rw-r--r--tests/optional/driver.cxx54
2 files changed, 60 insertions, 0 deletions
diff --git a/tests/optional/buildfile b/tests/optional/buildfile
new file mode 100644
index 0000000..68188d7
--- /dev/null
+++ b/tests/optional/buildfile
@@ -0,0 +1,6 @@
+# file : tests/optional/buildfile
+# license : MIT; see accompanying LICENSE file
+
+import libs = libbutl%lib{butl}
+
+exe{driver}: {hxx cxx}{*} $libs
diff --git a/tests/optional/driver.cxx b/tests/optional/driver.cxx
new file mode 100644
index 0000000..5dd8964
--- /dev/null
+++ b/tests/optional/driver.cxx
@@ -0,0 +1,54 @@
+// file : tests/optional/driver.cxx -*- C++ -*-
+// license : MIT; see accompanying LICENSE file
+
+#include <cassert>
+
+#ifndef __cpp_lib_modules_ts
+#include <vector>
+#include <utility> // move()
+#endif
+
+// Other includes.
+
+#ifdef __cpp_modules_ts
+#ifdef __cpp_lib_modules_ts
+import std.core;
+#endif
+import butl.optional;
+#else
+#include <libbutl/optional.mxx>
+#endif
+
+using namespace std;
+using namespace butl;
+
+struct redirect
+{
+ redirect () = default;
+
+ redirect (redirect&&) = default;
+ redirect& operator= (redirect&&) = default;
+
+ redirect (const redirect&) = delete;
+ redirect& operator= (const redirect&) = delete;
+};
+
+struct command
+{
+ butl::optional<redirect> err;
+};
+
+int
+main ()
+{
+ /*(
+ command c;
+ vector<command> cs;
+ cs.emplace_back (move (c));
+// cs.push_back (move (c));
+*/
+
+ redirect r;
+ vector<redirect> rs;
+ rs.emplace_back (move (r));
+}