summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2020-04-08 14:51:57 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2020-04-27 11:38:53 +0300
commit720c5a33b6a49cf328fdd7611f49153cf8f60247 (patch)
tree9725f3d1f42ec90fde84520f49647edea013ce5e /tests
parent3183f3bb927a90783ae0aeaf190a0919377aabe4 (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 'tests')
-rw-r--r--tests/.gitignore2
-rw-r--r--tests/build/.gitignore3
-rw-r--r--tests/build/bootstrap.build8
-rw-r--r--tests/build/root.build36
-rw-r--r--tests/buildfile4
-rw-r--r--tests/combined/buildfile9
-rw-r--r--tests/combined/driver.cxx39
-rw-r--r--tests/combined/test.cli16
-rw-r--r--tests/combined/testscript108
-rw-r--r--tests/ctor/buildfile8
-rw-r--r--tests/ctor/driver.cxx60
-rw-r--r--tests/ctor/test.cli8
-rw-r--r--tests/erase/buildfile10
-rw-r--r--tests/erase/driver.cxx34
-rw-r--r--tests/erase/test.cli9
-rw-r--r--tests/file/buildfile9
-rw-r--r--tests/file/driver.cxx39
-rw-r--r--tests/file/test.cli7
-rw-r--r--tests/file/testscript286
-rw-r--r--tests/group/buildfile9
-rw-r--r--tests/group/driver.cxx58
-rw-r--r--tests/group/test.cli7
-rw-r--r--tests/group/testscript140
-rw-r--r--tests/headings/buildfile4
-rw-r--r--tests/headings/testscript38
-rw-r--r--tests/inheritance/buildfile11
-rw-r--r--tests/inheritance/driver.cxx35
-rw-r--r--tests/inheritance/test.cli25
-rw-r--r--tests/inheritance/test.std4
-rw-r--r--tests/merge/buildfile9
-rw-r--r--tests/merge/driver.cxx55
-rw-r--r--tests/merge/test.cli18
-rw-r--r--tests/note/buildfile4
-rw-r--r--tests/note/testscript199
-rw-r--r--tests/specifier/buildfile10
-rw-r--r--tests/specifier/driver.cxx29
-rw-r--r--tests/specifier/test.cli12
-rw-r--r--tests/toc/buildfile4
-rw-r--r--tests/toc/testscript157
39 files changed, 0 insertions, 1523 deletions
diff --git a/tests/.gitignore b/tests/.gitignore
deleted file mode 100644
index 3381565..0000000
--- a/tests/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-driver
-test.?xx
diff --git a/tests/build/.gitignore b/tests/build/.gitignore
deleted file mode 100644
index 4a730a3..0000000
--- a/tests/build/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-config.build
-root/
-bootstrap/
diff --git a/tests/build/bootstrap.build b/tests/build/bootstrap.build
deleted file mode 100644
index c9187a6..0000000
--- a/tests/build/bootstrap.build
+++ /dev/null
@@ -1,8 +0,0 @@
-# file : tests/build/bootstrap.build
-# license : MIT; see accompanying LICENSE file
-
-project = # Unnamed subproject.
-
-using config
-using dist
-using test
diff --git a/tests/build/root.build b/tests/build/root.build
deleted file mode 100644
index 05bb1de..0000000
--- a/tests/build/root.build
+++ /dev/null
@@ -1,36 +0,0 @@
-# file : tests/build/root.build
-# license : MIT; see accompanying LICENSE file
-
-cxx.std = latest
-
-using cxx
-
-hxx{*}: extension = hxx
-ixx{*}: extension = ixx
-txx{*}: extension = txx
-cxx{*}: extension = cxx
-
-if ($cxx.target.system == 'win32-msvc')
- cxx.poptions += -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS
-
-if ($cxx.class == 'msvc')
- cxx.coptions += /wd4251 /wd4275 /wd4800
-
-# Load cli module. It must be available from the system or from the base
-# project. Generating files with cli is a part of the tests, so distributing
-# pre-generated files would be meaningless.
-#
-# @@ How to initialize the module to use a base project cli executable by
-# default (if present and not configured to use another one)? Should it be
-# assignment like 'config.cli = $out_root/../cli/cli' prior 'using config'
-# in bootstrap.build, but what if it doesn't exist?
-#
-using cli
-
-# Every exe{} in this subproject is by default a test.
-#
-exe{*}: test = true
-
-# Specify the test target for cross-testing.
-#
-test.target = $cxx.target
diff --git a/tests/buildfile b/tests/buildfile
deleted file mode 100644
index 556ed55..0000000
--- a/tests/buildfile
+++ /dev/null
@@ -1,4 +0,0 @@
-# file : tests/buildfile
-# license : MIT; see accompanying LICENSE file
-
-./: {*/ -build/}
diff --git a/tests/combined/buildfile b/tests/combined/buildfile
deleted file mode 100644
index 7d1e167..0000000
--- a/tests/combined/buildfile
+++ /dev/null
@@ -1,9 +0,0 @@
-# file : tests/combined/buildfile
-# license : MIT; see accompanying LICENSE file
-
-exe{driver}: {hxx cxx}{* -test} cli.cxx{test} testscript
-
-cxx.poptions =+ "-I$out_base"
-
-cli.cxx{test}: cli{test}
-cli.options = --generate-specifier --generate-file-scanner
diff --git a/tests/combined/driver.cxx b/tests/combined/driver.cxx
deleted file mode 100644
index ace3e64..0000000
--- a/tests/combined/driver.cxx
+++ /dev/null
@@ -1,39 +0,0 @@
-// file : tests/combined/driver.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-// Test combined flags (-xyz vs -x -y -z) and option values (--foo=bar).
-//
-
-#include <iostream>
-
-#include "test.hxx"
-
-using namespace std;
-
-int
-main (int argc, char* argv[])
-{
- try
- {
- cli::argv_file_scanner s (argc, argv, "--file");
- options o (s);
-
- if (o.foo_specified ())
- cout << "--foo=" << o.foo () << endl;
-
- if (o.x () || o.y () || o.z ())
- cout << '-'
- << (o.x () ? "x" : "")
- << (o.y () ? "y" : "")
- << (o.z () ? "z" : "") << endl;
-
- if (o.xyz ())
- cout << "--xyz" << endl;
- }
- catch (const cli::exception& e)
- {
- cerr << e << endl;
- return 1;
- }
-}
diff --git a/tests/combined/test.cli b/tests/combined/test.cli
deleted file mode 100644
index 1576859..0000000
--- a/tests/combined/test.cli
+++ /dev/null
@@ -1,16 +0,0 @@
-// file : tests/combined/test.cli
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-include <string>;
-
-class options
-{
- std::string --foo|-f;
-
- bool -x;
- bool -y;
- bool -z;
-
- bool --xyz;
-};
diff --git a/tests/combined/testscript b/tests/combined/testscript
deleted file mode 100644
index 986ed02..0000000
--- a/tests/combined/testscript
+++ /dev/null
@@ -1,108 +0,0 @@
-# file : tests/combined/testscript
-# license : MIT; see accompanying LICENSE file
-
-: values
-:
-{
- : long
- :
- $* --foo=123 >'--foo=123'
-
- : short
- :
- $* -f=123 >'--foo=123'
-
- : empty
- :
- $* --foo= >'--foo='
-
- : unknown-option-long
- :
- $* --bar=123 2>>EOE != 0
- unknown option '--bar'
- EOE
-
- : unknown-option-short
- :
- $* -b=123 2>>EOE != 0
- unknown option '-b'
- EOE
-
- : unknown-value
- :
- $* --xyz=123 2>>EOE != 0
- invalid value '123' for option '--xyz'
- EOE
-
- : options-file
- :
- {
- : basics
- :
- cat <<EOI >=options;
- --foo=123
- EOI
- $* --file=options >'--foo=123'
-
- : equal-in-value
- :
- cat <<EOI >=options;
- --foo bar=123
- EOI
- $* --file=options >'--foo=bar=123'
-
- : space-in-value
- :
- cat <<EOI >=options;
- --foo= 123
- EOI
- $* --file=options >'--foo= 123'
-
- : quoted-value
- :
- cat <<EOI >=options;
- --foo="'bar 123'"
- EOI
- $* --file=options >"--foo='bar 123'"
- }
-}
-
-: flags
-:
-{
- : basic
- :
- $* -zyx >'-xyz'
-
- : separate
- :
- $* -zx -y >'-xyz'
-
- : long
- :
- $* --xyz >'--xyz'
-
- : unknown-option
- :
- $* -xYz 2>>EOE != 0
- unknown option '-Y'
- EOE
-
- : alnum-only
- :
- $* -xy+ 2>>EOE != 0
- unknown option '-xy+'
- EOE
-
- : flags-only
- :
- $* -xyf 123 2>>EOE != 0
- missing value for option '-f'
- EOE
-
- : flags-only-combined
- :
- $* -xyf=123 2>>EOE != 0
- missing value for option '-f'
- EOE
-}
diff --git a/tests/ctor/buildfile b/tests/ctor/buildfile
deleted file mode 100644
index e41e87f..0000000
--- a/tests/ctor/buildfile
+++ /dev/null
@@ -1,8 +0,0 @@
-# file : tests/ctor/buildfile
-# license : MIT; see accompanying LICENSE file
-
-exe{driver}: {hxx cxx}{* -test} cli.cxx{test}
-
-cxx.poptions =+ "-I$out_base"
-
-cli.cxx{test}: cli{test}
diff --git a/tests/ctor/driver.cxx b/tests/ctor/driver.cxx
deleted file mode 100644
index cf7ec3b..0000000
--- a/tests/ctor/driver.cxx
+++ /dev/null
@@ -1,60 +0,0 @@
-// file : tests/ctor/driver.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-#include "test.hxx"
-
-int
-main (int argc, char* argv[])
-{
- // Test that we can call all the c-tors unambiguously.
- //
- {
- options o1 (argc, argv);
- options o2 (argc, argv, true);
- options o3 (argc, argv, true,
- cli::unknown_mode::fail);
- options o4 (argc, argv, true,
- cli::unknown_mode::fail,
- cli::unknown_mode::stop);
- }
-
- {
- options o1 (1, argc, argv);
- options o2 (1, argc, argv, true);
- options o3 (1, argc, argv, true,
- cli::unknown_mode::fail);
- options o4 (1, argc, argv, true,
- cli::unknown_mode::fail,
- cli::unknown_mode::stop);
- }
-
- {
- int end;
- options o1 (argc, argv, end);
- options o2 (argc, argv, end, true);
- options o3 (argc, argv, end, true,
- cli::unknown_mode::fail);
- options o4 (argc, argv, end, true,
- cli::unknown_mode::fail,
- cli::unknown_mode::stop);
- }
-
- {
- int end;
- options o1 (1, argc, argv, end);
- options o2 (1, argc, argv, end, true);
- options o3 (1, argc, argv, end, true,
- cli::unknown_mode::fail);
- options o4 (1, argc, argv, end, true,
- cli::unknown_mode::fail,
- cli::unknown_mode::stop);
- }
-
- {
- cli::argv_scanner s (argc, argv);
- options o1 (s);
- options o2 (s, cli::unknown_mode::fail);
- options o3 (s, cli::unknown_mode::fail, cli::unknown_mode::stop);
- }
-}
diff --git a/tests/ctor/test.cli b/tests/ctor/test.cli
deleted file mode 100644
index 869418d..0000000
--- a/tests/ctor/test.cli
+++ /dev/null
@@ -1,8 +0,0 @@
-// file : tests/ctor/test.cli
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-class options
-{
- bool --help;
-};
diff --git a/tests/erase/buildfile b/tests/erase/buildfile
deleted file mode 100644
index 7b2ebbd..0000000
--- a/tests/erase/buildfile
+++ /dev/null
@@ -1,10 +0,0 @@
-# file : tests/erase/buildfile
-# license : MIT; see accompanying LICENSE file
-
-exe{driver}: {hxx cxx}{* -test} cli.cxx{test}
-exe{driver}: test.arguments = foo -a bar -b 123 --arg -- -b 234
-
-cxx.poptions =+ "-I$out_base"
-
-cli.cxx{test}: cli{test}
-cli.options = --no-combined-flags # Can't be used with the skip unknown mode.
diff --git a/tests/erase/driver.cxx b/tests/erase/driver.cxx
deleted file mode 100644
index e2207ef..0000000
--- a/tests/erase/driver.cxx
+++ /dev/null
@@ -1,34 +0,0 @@
-// file : tests/erase/driver.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-// Test argument erasing.
-//
-
-#include <string>
-#include <cassert>
-
-#include "test.hxx"
-
-using namespace std;
-
-int
-main (int argc, char* argv[])
-{
- options o (argc, argv, true,
- cli::unknown_mode::skip,
- cli::unknown_mode::skip);
-
- assert (o.a ());
- assert (o.b () == 123);
-
- // We should have 'foo bar --arg -- -b 234'.
- //
- assert (argc == 7);
- assert (argv[1] == string ("foo"));
- assert (argv[2] == string ("bar"));
- assert (argv[3] == string ("--arg"));
- assert (argv[4] == string ("--"));
- assert (argv[5] == string ("-b"));
- assert (argv[6] == string ("234"));
-}
diff --git a/tests/erase/test.cli b/tests/erase/test.cli
deleted file mode 100644
index 7c14b69..0000000
--- a/tests/erase/test.cli
+++ /dev/null
@@ -1,9 +0,0 @@
-// file : tests/erase/test.cli
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-class options
-{
- bool -a;
- int -b;
-};
diff --git a/tests/file/buildfile b/tests/file/buildfile
deleted file mode 100644
index c5e4dd4..0000000
--- a/tests/file/buildfile
+++ /dev/null
@@ -1,9 +0,0 @@
-# file : tests/file/buildfile
-# license : MIT; see accompanying LICENSE file
-
-exe{driver}: {hxx cxx}{* -test} cli.cxx{test} testscript
-
-cxx.poptions =+ "-I$out_base"
-
-cli.cxx{test}: cli{test}
-cli.options = --generate-file-scanner
diff --git a/tests/file/driver.cxx b/tests/file/driver.cxx
deleted file mode 100644
index f964932..0000000
--- a/tests/file/driver.cxx
+++ /dev/null
@@ -1,39 +0,0 @@
-// file : tests/file/driver.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-// Test argv_file_scanner.
-//
-#include <memory>
-#include <string>
-#include <iostream>
-
-#include "test.hxx"
-
-using namespace std;
-
-int
-main (int argc, char* argv[])
-{
- try
- {
- string a (argc > 1 ? argv[1] : "");
-
- // Special modes.
- //
- // ---- <file>
- // --- <file>
- //
- unique_ptr<cli::scanner> s (
- a == "----" ? new cli::argv_file_scanner (argv[2], "--file") :
- a == "---" ? new cli::argv_file_scanner (argv[2]) :
- new cli::argv_file_scanner (argc, argv, "--file"));
-
- while (s->more ())
- cout << s->next () << endl;
- }
- catch (const cli::exception& e)
- {
- cerr << e << endl;
- }
-}
diff --git a/tests/file/test.cli b/tests/file/test.cli
deleted file mode 100644
index 617f42a..0000000
--- a/tests/file/test.cli
+++ /dev/null
@@ -1,7 +0,0 @@
-// file : tests/file/test.cli
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-class options
-{
-};
diff --git a/tests/file/testscript b/tests/file/testscript
deleted file mode 100644
index f4d04a7..0000000
--- a/tests/file/testscript
+++ /dev/null
@@ -1,286 +0,0 @@
-# file : tests/file/testscript
-# license : MIT; see accompanying LICENSE file
-
-# End-of-line marker. Place its expansion in here-documents after the trailing
-# spaces to prevent them from being stripped by editors and to improve
-# readability.
-#
-eol = ""
-
-+cat <<EOI >=empty.ops
-# Empty options file.
-#
-
-EOI
-+cat <<EOI >=base.ops
--a 21
--b 21
-EOI
-
-# @@ Give tests some meaningfull descriptions.
-#
-
-: 000
-:
-cat <<EOI >=test.ops;
--a 11
--b 11
- -a 12
-
- -b 12
-a
-EOI
-$* -a 1 --file ../empty.ops -b 1 --file ../base.ops --file test.ops b >>EOO
--a
-1
--b
-1
--a
-21
--b
-21
--a
-11
--b
-11
--a
-12
--b
-12
-a
-b
-EOO
-
-: 001
-:
-cat <<EOI >=test.ops;
-# Empty options file.
-#
-
-EOI
-$* -a 1 -- --file test.ops b >>EOO
--a
-1
---
---file
-test.ops
-b
-EOO
-
-: 002
-:
-cat <<EOI >=test.ops;
--a 11
--b 11
---
---file ../base.ops
--a 12
--b 12
-a
-EOI
-$* -a 1 --file test.ops --file ../empty.ops b >>EOO
--a
-1
--a
-11
--b
-11
---
---file
-../base.ops
--a
-12
--b
-12
-a
---file
-../empty.ops
-b
-EOO
-
-: 003
-:
-$* -a 1 --file ../base.ops --file test.ops b >>EOO 2>>EOE
--a
-1
--a
-21
--b
-21
-EOO
-unable to open file 'test.ops' or read failure
-EOE
-
-: 004
-:
-cat <<EOI >=test.ops;
--a a"b"c
--a "abc"
--a "a"b"
--a ""
--a " abc "
--a " "
--a """
--a "'"
-
--a a'b'c
--a 'abc'
--a 'a'b'
--a ''
--a ' abc '
--a ' '
--a '''
--a '"'
-EOI
-$* --file test.ops >>"EOO"
--a
-a"b"c
--a
-abc
--a
-a"b
--a
-
--a
- abc $eol
--a
- $eol
--a
-"
--a
-'
--a
-a'b'c
--a
-abc
--a
-a'b
--a
-
--a
- abc $eol
--a
- $eol
--a
-'
--a
-"
-EOO
-
-: 005
-:
-cat <<EOI >=test.ops;
--a "
-EOI
-$* --file test.ops 2>>EOE
-unmatched quote in argument '"'
-EOE
-
-: 006
-:
-cat <<EOI >=test.ops;
--a "abc
-EOI
-$* --file test.ops 2>>EOE
-unmatched quote in argument '"abc'
-EOE
-
-: 007
-:
-cat <<EOI >=test.ops;
--a abc"
-EOI
-$* --file test.ops 2>>EOE
-unmatched quote in argument 'abc"'
-EOE
-
-: 008
-:
-cat <<EOI >=test.ops;
--a '
-EOI
-$* --file test.ops 2>>EOE
-unmatched quote in argument '''
-EOE
-
-: 009
-:
-cat <<EOI >=test.ops;
--a 'abc
-EOI
-$* --file test.ops 2>>EOE
-unmatched quote in argument ''abc'
-EOE
-
-: 010
-:
-cat <<EOI >=test.ops;
--a abc'
-EOI
-$* --file test.ops 2>>EOE
-unmatched quote in argument 'abc''
-EOE
-
-: 011
-:
-cat <<EOI >=test.ops;
--a "abc'
-EOI
-$* --file test.ops 2>>EOE
-unmatched quote in argument '"abc''
-EOE
-
-: 012
-:
-cat <<EOI >=test.ops;
--a 'abc"
-EOI
-$* --file test.ops 2>>EOE
-unmatched quote in argument ''abc"'
-EOE
-
-: quoted-argument
-:
-cat <<EOI >=test.ops;
-"'foo bar'"
-'"foo bar"'
-EOI
-$* --file test.ops >>EOO
-'foo bar'
-"foo bar"
-EOO
-
-: direct-file-load
-:
-cat <<EOI >=test.ops;
--f
--a 123
-EOI
-$* --- test.ops >>EOO
--f
--a
-123
-EOO
-
-: direct-file-empty
-:
-cat <<EOI >=test.ops;
-EOI
-$* --- test.ops
-
-: direct-file-load-nested
-:
-cat <<EOI >=test.ops;
--f
---file ../base.ops
--a 123
-EOI
-$* ---- test.ops >>EOO
--f
--a
-21
--b
-21
--a
-123
-EOO
diff --git a/tests/group/buildfile b/tests/group/buildfile
deleted file mode 100644
index 427c68d..0000000
--- a/tests/group/buildfile
+++ /dev/null
@@ -1,9 +0,0 @@
-# file : tests/group/buildfile
-# license : MIT; see accompanying LICENSE file
-
-exe{driver}: {hxx cxx}{* -test} cli.cxx{test} testscript
-
-cxx.poptions =+ "-I$out_base"
-
-cli.cxx{test}: cli{test}
-cli.options = --generate-group-scanner
diff --git a/tests/group/driver.cxx b/tests/group/driver.cxx
deleted file mode 100644
index f24cdd8..0000000
--- a/tests/group/driver.cxx
+++ /dev/null
@@ -1,58 +0,0 @@
-// file : tests/group/driver.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-// Test group_scanner.
-//
-
-#include <iostream>
-
-#include "test.hxx"
-
-using namespace std;
-
-int
-main (int argc, char* argv[])
-{
- try
- {
- using namespace cli;
-
- // Mode flags.
- //
- // 'g' -- don't handle groups.
- // 's' -- skip arguments.
- //
- string m (argv[1]);
-
- argv_scanner as (--argc, ++argv);
- group_scanner s (as);
-
- while (s.more ())
- {
- if (m.find ('s') == string::npos)
- {
- const char* a (s.next ());
- cout << "'" << a << "'";
- }
- else
- s.skip ();
-
- if (m.find ('g') == string::npos)
- {
- scanner& gs (s.group ());
- while (gs.more ())
- cout << " '" << gs.next () << "'";
- }
-
- cout << endl;
- }
-
- return 0;
- }
- catch (const cli::exception& e)
- {
- cerr << e << endl;
- return 1;
- }
-}
diff --git a/tests/group/test.cli b/tests/group/test.cli
deleted file mode 100644
index f4c1584..0000000
--- a/tests/group/test.cli
+++ /dev/null
@@ -1,7 +0,0 @@
-// file : tests/group/test.cli
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-class options
-{
-};
diff --git a/tests/group/testscript b/tests/group/testscript
deleted file mode 100644
index 1370cbe..0000000
--- a/tests/group/testscript
+++ /dev/null
@@ -1,140 +0,0 @@
-# file : tests/group/testscript
-# license : MIT; see accompanying LICENSE file
-
-: no-args
-:
-$* ''
-
-: no-groups
-:
-$* '' --foo arg >>EOO
-'--foo'
-'arg'
-EOO
-
-: group-pre
-:
-$* '' { --foo --bar }+ arg1 arg2 >>EOO
-'arg1' '--foo' '--bar'
-'arg2'
-EOO
-
-: group-pre-multi
-:
-$* '' { --foo }+ { --bar }+ arg1 arg2 >>EOO
-'arg1' '--foo' '--bar'
-'arg2'
-EOO
-
-: group-post
-:
-$* '' arg1 arg2 +{ foo bar } >>EOO
-'arg1'
-'arg2' 'foo' 'bar'
-EOO
-
-: group-post-multi
-:
-$* '' arg1 arg2 +{ foo } +{ bar } >>EOO
-'arg1'
-'arg2' 'foo' 'bar'
-EOO
-
-: group-both
-:
-$* '' arg1 { --foo --bar }+ arg2 +{ foo bar } arg3 >>EOO
-'arg1'
-'arg2' '--foo' '--bar' 'foo' 'bar'
-'arg3'
-EOO
-
-: group-both-multi
-:
-$* '' arg1 { --foo }+ { --bar }+ arg2 +{ foo } +{ bar } arg3 >>EOO
-'arg1'
-'arg2' '--foo' '--bar' 'foo' 'bar'
-'arg3'
-EOO
-
-: multi-group
-:
-$* '' { --foo }+ arg1 arg2 +{ bar } >>EOO
-'arg1' '--foo'
-'arg2' 'bar'
-EOO
-
-: empty-group
-:
-$* '' { }+ arg1 arg2 +{ } >>EOO
-'arg1'
-'arg2'
-EOO
-
-: escape-arg
-:
-$* '' '\{' '\}' '\+{' '\}+' '{x' '}x' >>EOO
-'{'
-'}'
-'+{'
-'}+'
-'{x'
-'}x'
-EOO
-
-: escape-group
-:
-$* '' { '\{' '\}' '\+{' '\}+' '{x' '}x' }+ arg >>EOO
-'arg' '{' '}' '+{' '}+' '{x' '}x'
-EOO
-
-: not-group
-:
-$* '' { --foo } 2>>EOE != 0
-expected group separator '}+' instead of '}', use '\}' to escape
-EOE
-
-: no-arg-pre
-:
-$* '' { --foo }+ 2>>EOE != 0
-unexpected group separator '{', use '\{' to escape
-EOE
-
-: no-arg-pre-empty
-:
-$* '' { }+ 2>>EOE != 0
-unexpected group separator '{', use '\{' to escape
-EOE
-
-: no-arg-post
-:
-$* '' +{ --foo } 2>>EOE != 0
-unexpected group separator '+{', use '\+{' to escape
-EOE
-
-: no-arg-post-empty
-:
-$* '' +{ } 2>>EOE != 0
-unexpected group separator '+{', use '\+{' to escape
-EOE
-
-: unhandled-group-pre
-:
-$* 'g' { --foo }+ arg >>EOO 2>>EOE != 0
-'arg'
-EOO
-unexpected grouped argument '--foo' for argument 'arg'
-EOE
-
-: unhandled-group-post
-:
-$* 'g' arg +{ bar } >>EOO 2>>EOE != 0
-'arg'
-EOO
-unexpected grouped argument 'bar' for argument 'arg'
-EOE
-
-: unhandled-group-skip
-:
-$* 'sg' { --foo }+ arg +{ bar } >>EOO
-
-EOO
diff --git a/tests/headings/buildfile b/tests/headings/buildfile
deleted file mode 100644
index 4ece7d6..0000000
--- a/tests/headings/buildfile
+++ /dev/null
@@ -1,4 +0,0 @@
-# file : tests/headings/buildfile
-# license : MIT; see accompanying LICENSE file
-
-./: testscript
diff --git a/tests/headings/testscript b/tests/headings/testscript
deleted file mode 100644
index 0827890..0000000
--- a/tests/headings/testscript
+++ /dev/null
@@ -1,38 +0,0 @@
-# file : tests/headings/testscript
-# license : MIT; see accompanying LICENSE file
-
-test = $effect($cli.path)
-
-: auto-headings
-:
-: Note that auto-headings break if we split into multiple doc strings.
-:
-cat <<EOI >=map.cli;
-"
-\h1|Heading 1|
-
-\h|Heading 1.1|
-
-\h2|Heading 1.1.1|
-
-\h|Heading 1.2|
-
-\h2|Heading 1.2.1|
-
-\h1|Heading 2|
-"
-EOI
-$* --generate-html --stdout map.cli >>EOO
- <h1>Heading 1</h1>
-
- <h2>Heading 1.1</h2>
-
- <h3>Heading 1.1.1</h3>
-
- <h2>Heading 1.2</h2>
-
- <h3>Heading 1.2.1</h3>
-
- <h1>Heading 2</h1>
-
-EOO
diff --git a/tests/inheritance/buildfile b/tests/inheritance/buildfile
deleted file mode 100644
index f1b72ce..0000000
--- a/tests/inheritance/buildfile
+++ /dev/null
@@ -1,11 +0,0 @@
-# file : tests/inheritance/buildfile
-# license : MIT; see accompanying LICENSE file
-
-exe{driver}: {hxx cxx}{* -test} cli.cxx{test}
-exe{driver}: file{test.std}: test.stdout = true
-exe{driver}: test.arguments = --very-long-flag -s short -i 123 --string long
-
-cxx.poptions =+ "-I$out_base"
-
-cli.cxx{test}: cli{test}
-cli.options = --generate-description --option-length 17
diff --git a/tests/inheritance/driver.cxx b/tests/inheritance/driver.cxx
deleted file mode 100644
index 5ecb019..0000000
--- a/tests/inheritance/driver.cxx
+++ /dev/null
@@ -1,35 +0,0 @@
-// file : tests/inheritance/driver.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-// Test option class inheritance.
-//
-
-#include <string>
-#include <cassert>
-#include <iostream>
-
-#include "test.hxx"
-
-using namespace std;
-
-int
-main (int argc, char* argv[])
-{
- const cli::options& d (options::description ());
-
- assert (d.size () == 4);
- assert (d[0].name () == "--very-long-flag");
- assert (d[1].name () == "-i");
- assert (d[2].name () == "-s");
- assert (d[3].name () == "--string");
-
- options o (argc, argv);
-
- assert (o.very_long_flag ());
- assert (o.s () == "short");
- assert (o.i () == 123);
- assert (o.string () == "long");
-
- options::print_usage (cout);
-}
diff --git a/tests/inheritance/test.cli b/tests/inheritance/test.cli
deleted file mode 100644
index 9e43bb5..0000000
--- a/tests/inheritance/test.cli
+++ /dev/null
@@ -1,25 +0,0 @@
-// file : tests/inheritance/test.cli
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-include <string>;
-
-class base1 = 0
-{
- bool --very-long-flag {"Long flag."};
-};
-
-class base2
-{
- std::string -s {"<str>", "Short string."};
-};
-
-class interm: base1
-{
- int -i = 1 {"<num>", "Integer."};
-};
-
-class options: interm, base2
-{
- std::string --string {"<str>", "Long string."};
-};
diff --git a/tests/inheritance/test.std b/tests/inheritance/test.std
deleted file mode 100644
index 4c93225..0000000
--- a/tests/inheritance/test.std
+++ /dev/null
@@ -1,4 +0,0 @@
---very-long-flag Long flag.
--i <num> Integer.
--s <str> Short string.
---string <str> Long string.
diff --git a/tests/merge/buildfile b/tests/merge/buildfile
deleted file mode 100644
index d786ad8..0000000
--- a/tests/merge/buildfile
+++ /dev/null
@@ -1,9 +0,0 @@
-# file : tests/merge/buildfile
-# license : MIT; see accompanying LICENSE file
-
-exe{driver}: {hxx cxx}{* -test} cli.cxx{test}
-
-cxx.poptions =+ "-I$out_base"
-
-cli.cxx{test}: cli{test}
-cli.options = --generate-merge
diff --git a/tests/merge/driver.cxx b/tests/merge/driver.cxx
deleted file mode 100644
index 0420442..0000000
--- a/tests/merge/driver.cxx
+++ /dev/null
@@ -1,55 +0,0 @@
-// file : tests/merge/driver.cxx
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-// Test parsed options merging.
-//
-
-#include <string>
-#include <cassert>
-
-#include "test.hxx"
-
-using namespace std;
-
-template <typename T, int N1, int N2>
-static T
-merge (const char* (&av1)[N1], const char* (&av2)[N2])
-{
- int ac1 (N1);
- int ac2 (N2);
- T o1 (ac1, const_cast<char**> (av1));
- T o2 (ac2, const_cast<char**> (av2));
- o1.merge (o2);
- return o1;
-}
-
-int
-main ()
-{
- // Basics.
- //
- {
- const char* a1[] = {"", "-i=123", "-v=1", "-v=2"};
- const char* a2[] = {"", "-b", "-i=456", "-s=xyz", "-v=3", "-v=4"};
- derived r (merge<derived> (a1, a2));
-
- assert (r.b ());
- assert (r.i_specified () && r.i () == 456);
- assert (r.s_specified () && r.s () == "xyz");
- assert (r.v_specified () && r.v ().size () == 4 &&
- r.v ()[0] == 1 &&
- r.v ()[1] == 2 &&
- r.v ()[2] == 3 &&
- r.v ()[3] == 4);
- }
-
- // Default value does not override.
- //
- {
- const char* a1[] = {"", "-i=456"};
- const char* a2[] = {"" };
- derived r (merge<derived> (a1, a2));
- assert (r.i_specified () && r.i () == 456);
- }
-}
diff --git a/tests/merge/test.cli b/tests/merge/test.cli
deleted file mode 100644
index 4c61f6a..0000000
--- a/tests/merge/test.cli
+++ /dev/null
@@ -1,18 +0,0 @@
-// file : tests/merge/test.cli
-// author : Boris Kolpackov <boris@codesynthesis.com>
-// license : MIT; see accompanying LICENSE file
-
-include <string>;
-include <vector>;
-
-class base
-{
- bool -b;
- int -i = -1;
- std::string -s;
-};
-
-class derived: base
-{
- std::vector<int> -v;
-};
diff --git a/tests/note/buildfile b/tests/note/buildfile
deleted file mode 100644
index f1296d1..0000000
--- a/tests/note/buildfile
+++ /dev/null
@@ -1,4 +0,0 @@
-# file : tests/note/buildfile
-# license : MIT; see accompanying LICENSE file
-
-./: testscript
diff --git a/tests/note/testscript b/tests/note/testscript
deleted file mode 100644
index 0646d79..0000000
--- a/tests/note/testscript
+++ /dev/null
@@ -1,199 +0,0 @@
-# file : tests/note/testscript
-# license : MIT; see accompanying LICENSE file
-
-test = $effect($cli.path)
-
-: block-basics
-:
-cat <<EOI >=test.cli;
-"
-Leading paragraph.
-
-\N|This is a note block one.|
-
-Interleaving paragraph that is quite long and therefore it may span many
-lines in order to make text easy to read.
-
-\N|This is a note block two that is quite long and therefore it may span many
-lines in order to make text easy to read.|
-
-Trailing paragraph.
-"
-EOI
-$* --generate-html --stdout test.cli >>EOO;
- <p>Leading paragraph.</p>
-
- <div class="note">
- <p>This is a note block one.</p>
- </div>
-
- <p>Interleaving paragraph that is quite long and therefore it may span many
- lines in order to make text easy to read.</p>
-
- <div class="note">
- <p>This is a note block two that is quite long and therefore it may span
- many lines in order to make text easy to read.</p>
- </div>
-
- <p>Trailing paragraph.</p>
-
-EOO
- $* --generate-txt --stdout test.cli >>EOO
-Leading paragraph.
-
-| This is a note block one.
-
-Interleaving paragraph that is quite long and therefore it may span many lines
-in order to make text easy to read.
-
-| This is a note block two that is quite long and therefore it may span many
-| lines in order to make text easy to read.
-
-Trailing paragraph.
-EOO
-
-
-: block-multi-para
-:
-cat <<EOI >=test.cli;
-"
-\N|
-This is a note para one that is quite long and therefore it may span many
-lines in order to make text easy to read.
-
-This is a note para two.
-|
-"
-EOI
-$* --generate-html --stdout test.cli >>EOO;
- <div class="note">
- <p>This is a note para one that is quite long and therefore it may span many
- lines in order to make text easy to read.</p>
-
- <p>This is a note para two.</p>
- </div>
-
-EOO
-$* --generate-txt --stdout test.cli >>EOO
-| This is a note para one that is quite long and therefore it may span many
-| lines in order to make text easy to read.
-|
-| This is a note para two.
-EOO
-
-: block-pre
-:
-cat <<EOI >=test.cli;
-"
-
-\N|
-This is a note para one.
-
-\
-And this is a
-pre-formatter text fragment.
-\
-
-|
-"
-EOI
-$* --generate-html --stdout test.cli >>EOO;
- <div class="note">
- <p>This is a note para one.</p>
-
- <pre>And this is a
-pre-formatter text fragment.</pre>
- </div>
-
-EOO
-$* --generate-txt --stdout test.cli >>EOO
-| This is a note para one.
-|
-| And this is a
-| pre-formatter text fragment.
-EOO
-
-# This is not yet supported (see txt_wrap_lines()).
-#
-#\
-: block-list
-:
-cat <<EOI >=test.cli;
-"
-\N|This is a note para one followed by a list.
-
-\ul|
-
-\li|This is a list item that is quite long and therefore it may span many
-lines in order to make text easy to read.|||
-"
-EOI
-$* --generate-html --stdout test.cli >>EOO;
-EOO
-$* --generate-txt --stdout test.cli >>EOO
-EOO
-#\
-
-: block-in-list
-:
-cat <<EOI >=test.cli;
-"
-\ul|
-
-\li|Normal text para.
-
-\N|This is a note para one that is quite long and therefore it may span many
-lines in order to make text easy to read.|||
-"
-EOI
-$* --generate-html --stdout test.cli >>EOO;
- <ul>
- <li>Normal text para.
-
- <div class="note">
- <p>This is a note para one that is quite long and therefore it may span many
- lines in order to make text easy to read.</p>
- </div></li>
- </ul>
-
-EOO
-$* --generate-txt --stdout test.cli >>EOO
-* Normal text para.
-
- | This is a note para one that is quite long and therefore it may span many
- | lines in order to make text easy to read.
-EOO
-
-
-: span-basics
-:
-cat <<EOI >=test.cli;
-"
-This is normal text. \N{This is a note.} And this is normal text again.
-"
-EOI
-$* --generate-html --stdout test.cli >>EOO;
- <p>This is normal text. <span class="note">This is a note.</span> And this
- is normal text again.</p>
-
-EOO
- $* --generate-txt --stdout test.cli >>EOO
-This is normal text. [Note: This is a note.] And this is normal text again.
-EOO
-
-
-: span-nested-link
-:
-cat <<EOI >=test.cli;
-"
-\N{This is a note with a \l{https://example.com link} inside.}
-"
-EOI
-$* --generate-html --stdout test.cli >>EOO;
- <p><span class="note">This is a note with a <a
- href="https://example.com">link</a> inside.</span></p>
-
-EOO
-$* --generate-txt --stdout test.cli >>EOO
-[Note: This is a note with a link (https://example.com) inside.]
-EOO
diff --git a/tests/specifier/buildfile b/tests/specifier/buildfile
deleted file mode 100644
index 3a0e42e..0000000
--- a/tests/specifier/buildfile
+++ /dev/null
@@ -1,10 +0,0 @@
-# file : tests/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/tests/specifier/driver.cxx b/tests/specifier/driver.cxx
deleted file mode 100644
index 0194bbe..0000000
--- a/tests/specifier/driver.cxx
+++ /dev/null
@@ -1,29 +0,0 @@
-// file : tests/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/tests/specifier/test.cli b/tests/specifier/test.cli
deleted file mode 100644
index f8fdf96..0000000
--- a/tests/specifier/test.cli
+++ /dev/null
@@ -1,12 +0,0 @@
-// file : tests/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;
-};
diff --git a/tests/toc/buildfile b/tests/toc/buildfile
deleted file mode 100644
index 468eebc..0000000
--- a/tests/toc/buildfile
+++ /dev/null
@@ -1,4 +0,0 @@
-# file : tests/toc/buildfile
-# license : MIT; see accompanying LICENSE file
-
-./: testscript
diff --git a/tests/toc/testscript b/tests/toc/testscript
deleted file mode 100644
index 4192a7e..0000000
--- a/tests/toc/testscript
+++ /dev/null
@@ -1,157 +0,0 @@
-# file : tests/toc/testscript
-# license : MIT; see accompanying LICENSE file
-
-test = $effect($cli.path)
-
-: toc
-:
-cat <<EOI >=toc.cli;
-"\h1|Table of Contents|"
-"\$TOC$"
-
-"
-\h0#preface|Preface|
-
-This document describes something awesome.
-
-\h#about-document|About This Document|
-
-And this document is also awesome.
-
-\h#more-information|More Information|
-
-It is so awesome that no further information will be required."
-
-"
-\H#part1|PART I|
-
-Start of part one.
-
-\h1#intro|Introduction|
-
-Beginning of the first chapter.
-
-\h#arch-flow|Architecture and Workflow|
-
-Some basics.
-
-\h#benefits|Benefits|
-
-You will like them.
-
-\h1#hello|Hello World|
-
-Beginning of the second chapter.
-
-\h#hell-setup|Setup|
-
-More basics.
-
-\h#hello-compile|Compiling|
-
-How to build the example
-
-\h2#hello-compile-gcc|Compiling with GCC|
-
-GCC. For Clang see \l{#hello-compile-clang Compiling with Clang}.
-
-\h2#hello-compile-clang|Compiling with Clang|
-
-Clang. For GCC see \l{#hello-compile-gcc Compiling with GCC}.
-
-\h#hello-conclusion|Conclusion|
-
-Some remarks.
-"
-EOI
-$* --generate-html --stdout toc.cli >>EOO
- <h1>Table of Contents</h1>
-
- <table class="toc">
- <tr><td class="preface" colspan="2"><a href="#preface">Preface</a>
- <table class="toc">
- <tr><td class="preface" colspan="2"><a href="#about-document">About
-This Document</a></td></tr>
- <tr><td class="preface" colspan="2"><a href="#more-information">More
-Information</a></td></tr>
- </table>
- </td></tr>
- <tr><th colspan="2"><a href="#part1">PART I</a></th></tr>
- <tr><th>1</th><td><a href="#intro">Introduction</a>
- <table class="toc">
- <tr><th>1.1</th><td><a href="#arch-flow">Architecture and
-Workflow</a></td></tr>
- <tr><th>1.2</th><td><a href="#benefits">Benefits</a></td></tr>
- </table>
- </td></tr>
- <tr><th>2</th><td><a href="#hello">Hello World</a>
- <table class="toc">
- <tr><th>2.1</th><td><a href="#hell-setup">Setup</a></td></tr>
- <tr><th>2.2</th><td><a href="#hello-compile">Compiling</a>
- <table class="toc">
- <tr><th>2.2.1</th><td><a href="#hello-compile-gcc">Compiling with
-GCC</a></td></tr>
- <tr><th>2.2.2</th><td><a href="#hello-compile-clang">Compiling
-with Clang</a></td></tr>
- </table>
- </td></tr>
- <tr><th>2.3</th><td><a href="#hello-conclusion">Conclusion</a></td></tr>
- </table>
- </td></tr>
- </table>
-
- <h1 id="preface" class="preface">Preface</h1>
-
- <p>This document describes something awesome.</p>
-
- <h2 id="about-document">About This Document</h2>
-
- <p>And this document is also awesome.</p>
-
- <h2 id="more-information">More Information</h2>
-
- <p>It is so awesome that no further information will be required.</p>
-
- <h1 id="part1" class="part">PART I</h1>
-
- <p>Start of part one.</p>
-
- <h1 id="intro">1 Introduction</h1>
-
- <p>Beginning of the first chapter.</p>
-
- <h2 id="arch-flow">1.1 Architecture and Workflow</h2>
-
- <p>Some basics.</p>
-
- <h2 id="benefits">1.2 Benefits</h2>
-
- <p>You will like them.</p>
-
- <h1 id="hello">2 Hello World</h1>
-
- <p>Beginning of the second chapter.</p>
-
- <h2 id="hell-setup">2.1 Setup</h2>
-
- <p>More basics.</p>
-
- <h2 id="hello-compile">2.2 Compiling</h2>
-
- <p>How to build the example</p>
-
- <h3 id="hello-compile-gcc">2.2.1 Compiling with GCC</h3>
-
- <p>GCC. For Clang see <a href="#hello-compile-clang">Compiling with
- Clang</a>.</p>
-
- <h3 id="hello-compile-clang">2.2.2 Compiling with Clang</h3>
-
- <p>Clang. For GCC see <a href="#hello-compile-gcc">Compiling with
- GCC</a>.</p>
-
- <h2 id="hello-conclusion">2.3 Conclusion</h2>
-
- <p>Some remarks.</p>
-
-EOO