summaryrefslogtreecommitdiff
path: root/cli-tests/specifier
diff options
context:
space:
mode:
Diffstat (limited to 'cli-tests/specifier')
-rw-r--r--cli-tests/specifier/buildfile10
-rw-r--r--cli-tests/specifier/driver.cxx29
-rw-r--r--cli-tests/specifier/test.cli12
3 files changed, 51 insertions, 0 deletions
diff --git a/cli-tests/specifier/buildfile b/cli-tests/specifier/buildfile
new file mode 100644
index 0000000..935a002
--- /dev/null
+++ b/cli-tests/specifier/buildfile
@@ -0,0 +1,10 @@
+# file : specifier/buildfile
+# license : MIT; see accompanying LICENSE file
+
+exe{driver}: {hxx cxx}{* -test} cli.cxx{test}
+exe{driver}: test.arguments = -a -c foo
+
+cxx.poptions =+ "-I$out_base"
+
+cli.cxx{test}: cli{test}
+cli.options = --generate-specifier --generate-modifier
diff --git a/cli-tests/specifier/driver.cxx b/cli-tests/specifier/driver.cxx
new file mode 100644
index 0000000..50b9cf5
--- /dev/null
+++ b/cli-tests/specifier/driver.cxx
@@ -0,0 +1,29 @@
+// file : specifier/driver.cxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// license : MIT; see accompanying LICENSE file
+
+// Test specifier functions.
+//
+
+#include <string>
+#include <cassert>
+
+#include "test.hxx"
+
+using namespace std;
+
+int
+main (int argc, char* argv[])
+{
+ options o (argc, argv);
+
+ assert (o.a ());
+ assert (o.b () == 1 && !o.b_specified ());
+ assert (o.c () == "foo" && o.c_specified ());
+
+ o.b_specified (true);
+ o.c_specified (false);
+
+ assert (o.b_specified ());
+ assert (!o.c_specified ());
+}
diff --git a/cli-tests/specifier/test.cli b/cli-tests/specifier/test.cli
new file mode 100644
index 0000000..c11ebb7
--- /dev/null
+++ b/cli-tests/specifier/test.cli
@@ -0,0 +1,12 @@
+// file : specifier/test.cli
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// license : MIT; see accompanying LICENSE file
+
+include <string>;
+
+class options
+{
+ bool -a;
+ int -b = 1;
+ std::string -c;
+};