From 720c5a33b6a49cf328fdd7611f49153cf8f60247 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 8 Apr 2020 14:51:57 +0300 Subject: Separate tests and examples into individual packages Also make cli module to be explicitly enabled via the config.cli configuration variable. --- cli-tests/specifier/buildfile | 10 ++++++++++ cli-tests/specifier/driver.cxx | 29 +++++++++++++++++++++++++++++ cli-tests/specifier/test.cli | 12 ++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 cli-tests/specifier/buildfile create mode 100644 cli-tests/specifier/driver.cxx create mode 100644 cli-tests/specifier/test.cli (limited to 'cli-tests/specifier') 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 +// license : MIT; see accompanying LICENSE file + +// Test specifier functions. +// + +#include +#include + +#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 +// license : MIT; see accompanying LICENSE file + +include ; + +class options +{ + bool -a; + int -b = 1; + std::string -c; +}; -- cgit v1.1