diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-04-08 14:51:57 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2020-04-27 11:38:53 +0300 |
commit | 720c5a33b6a49cf328fdd7611f49153cf8f60247 (patch) | |
tree | 9725f3d1f42ec90fde84520f49647edea013ce5e /cli-tests/specifier | |
parent | 3183f3bb927a90783ae0aeaf190a0919377aabe4 (diff) |
Separate tests and examples into individual packages
Also make cli module to be explicitly enabled via the config.cli configuration
variable.
Diffstat (limited to 'cli-tests/specifier')
-rw-r--r-- | cli-tests/specifier/buildfile | 10 | ||||
-rw-r--r-- | cli-tests/specifier/driver.cxx | 29 | ||||
-rw-r--r-- | cli-tests/specifier/test.cli | 12 |
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; +}; |