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. --- tests/.gitignore | 2 - tests/build/.gitignore | 3 - tests/build/bootstrap.build | 8 -- tests/build/root.build | 36 ------ tests/buildfile | 4 - tests/combined/buildfile | 9 -- tests/combined/driver.cxx | 39 ------ tests/combined/test.cli | 16 --- tests/combined/testscript | 108 ---------------- tests/ctor/buildfile | 8 -- tests/ctor/driver.cxx | 60 --------- tests/ctor/test.cli | 8 -- tests/erase/buildfile | 10 -- tests/erase/driver.cxx | 34 ----- tests/erase/test.cli | 9 -- tests/file/buildfile | 9 -- tests/file/driver.cxx | 39 ------ tests/file/test.cli | 7 -- tests/file/testscript | 286 ------------------------------------------- tests/group/buildfile | 9 -- tests/group/driver.cxx | 58 --------- tests/group/test.cli | 7 -- tests/group/testscript | 140 --------------------- tests/headings/buildfile | 4 - tests/headings/testscript | 38 ------ tests/inheritance/buildfile | 11 -- tests/inheritance/driver.cxx | 35 ------ tests/inheritance/test.cli | 25 ---- tests/inheritance/test.std | 4 - tests/merge/buildfile | 9 -- tests/merge/driver.cxx | 55 --------- tests/merge/test.cli | 18 --- tests/note/buildfile | 4 - tests/note/testscript | 199 ------------------------------ tests/specifier/buildfile | 10 -- tests/specifier/driver.cxx | 29 ----- tests/specifier/test.cli | 12 -- tests/toc/buildfile | 4 - tests/toc/testscript | 157 ------------------------ 39 files changed, 1523 deletions(-) delete mode 100644 tests/.gitignore delete mode 100644 tests/build/.gitignore delete mode 100644 tests/build/bootstrap.build delete mode 100644 tests/build/root.build delete mode 100644 tests/buildfile delete mode 100644 tests/combined/buildfile delete mode 100644 tests/combined/driver.cxx delete mode 100644 tests/combined/test.cli delete mode 100644 tests/combined/testscript delete mode 100644 tests/ctor/buildfile delete mode 100644 tests/ctor/driver.cxx delete mode 100644 tests/ctor/test.cli delete mode 100644 tests/erase/buildfile delete mode 100644 tests/erase/driver.cxx delete mode 100644 tests/erase/test.cli delete mode 100644 tests/file/buildfile delete mode 100644 tests/file/driver.cxx delete mode 100644 tests/file/test.cli delete mode 100644 tests/file/testscript delete mode 100644 tests/group/buildfile delete mode 100644 tests/group/driver.cxx delete mode 100644 tests/group/test.cli delete mode 100644 tests/group/testscript delete mode 100644 tests/headings/buildfile delete mode 100644 tests/headings/testscript delete mode 100644 tests/inheritance/buildfile delete mode 100644 tests/inheritance/driver.cxx delete mode 100644 tests/inheritance/test.cli delete mode 100644 tests/inheritance/test.std delete mode 100644 tests/merge/buildfile delete mode 100644 tests/merge/driver.cxx delete mode 100644 tests/merge/test.cli delete mode 100644 tests/note/buildfile delete mode 100644 tests/note/testscript delete mode 100644 tests/specifier/buildfile delete mode 100644 tests/specifier/driver.cxx delete mode 100644 tests/specifier/test.cli delete mode 100644 tests/toc/buildfile delete mode 100644 tests/toc/testscript (limited to 'tests') 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 -// license : MIT; see accompanying LICENSE file - -// Test combined flags (-xyz vs -x -y -z) and option values (--foo=bar). -// - -#include - -#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 -// license : MIT; see accompanying LICENSE file - -include ; - -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 <=options; - --foo=123 - EOI - $* --file=options >'--foo=123' - - : equal-in-value - : - cat <=options; - --foo bar=123 - EOI - $* --file=options >'--foo=bar=123' - - : space-in-value - : - cat <=options; - --foo= 123 - EOI - $* --file=options >'--foo= 123' - - : quoted-value - : - cat <=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 -// 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 -// 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 -// license : MIT; see accompanying LICENSE file - -// Test argument erasing. -// - -#include -#include - -#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 -// 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 -// license : MIT; see accompanying LICENSE file - -// Test argv_file_scanner. -// -#include -#include -#include - -#include "test.hxx" - -using namespace std; - -int -main (int argc, char* argv[]) -{ - try - { - string a (argc > 1 ? argv[1] : ""); - - // Special modes. - // - // ---- - // --- - // - unique_ptr 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 -// 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 <=empty.ops -# Empty options file. -# - -EOI -+cat <=base.ops --a 21 --b 21 -EOI - -# @@ Give tests some meaningfull descriptions. -# - -: 000 -: -cat <=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 <=test.ops; -# Empty options file. -# - -EOI -$* -a 1 -- --file test.ops b >>EOO --a -1 --- ---file -test.ops -b -EOO - -: 002 -: -cat <=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 <=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 <=test.ops; --a " -EOI -$* --file test.ops 2>>EOE -unmatched quote in argument '"' -EOE - -: 006 -: -cat <=test.ops; --a "abc -EOI -$* --file test.ops 2>>EOE -unmatched quote in argument '"abc' -EOE - -: 007 -: -cat <=test.ops; --a abc" -EOI -$* --file test.ops 2>>EOE -unmatched quote in argument 'abc"' -EOE - -: 008 -: -cat <=test.ops; --a ' -EOI -$* --file test.ops 2>>EOE -unmatched quote in argument ''' -EOE - -: 009 -: -cat <=test.ops; --a 'abc -EOI -$* --file test.ops 2>>EOE -unmatched quote in argument ''abc' -EOE - -: 010 -: -cat <=test.ops; --a abc' -EOI -$* --file test.ops 2>>EOE -unmatched quote in argument 'abc'' -EOE - -: 011 -: -cat <=test.ops; --a "abc' -EOI -$* --file test.ops 2>>EOE -unmatched quote in argument '"abc'' -EOE - -: 012 -: -cat <=test.ops; --a 'abc" -EOI -$* --file test.ops 2>>EOE -unmatched quote in argument ''abc"' -EOE - -: quoted-argument -: -cat <=test.ops; -"'foo bar'" -'"foo bar"' -EOI -$* --file test.ops >>EOO -'foo bar' -"foo bar" -EOO - -: direct-file-load -: -cat <=test.ops; --f --a 123 -EOI -$* --- test.ops >>EOO --f --a -123 -EOO - -: direct-file-empty -: -cat <=test.ops; -EOI -$* --- test.ops - -: direct-file-load-nested -: -cat <=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 -// license : MIT; see accompanying LICENSE file - -// Test group_scanner. -// - -#include - -#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 -// 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 <=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 -

Heading 1

- -

Heading 1.1

- -

Heading 1.1.1

- -

Heading 1.2

- -

Heading 1.2.1

- -

Heading 2

- -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 -// license : MIT; see accompanying LICENSE file - -// Test option class inheritance. -// - -#include -#include -#include - -#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 -// license : MIT; see accompanying LICENSE file - -include ; - -class base1 = 0 -{ - bool --very-long-flag {"Long flag."}; -}; - -class base2 -{ - std::string -s {"", "Short string."}; -}; - -class interm: base1 -{ - int -i = 1 {"", "Integer."}; -}; - -class options: interm, base2 -{ - std::string --string {"", "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 Integer. --s Short string. ---string 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 -// license : MIT; see accompanying LICENSE file - -// Test parsed options merging. -// - -#include -#include - -#include "test.hxx" - -using namespace std; - -template -static T -merge (const char* (&av1)[N1], const char* (&av2)[N2]) -{ - int ac1 (N1); - int ac2 (N2); - T o1 (ac1, const_cast (av1)); - T o2 (ac2, const_cast (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 (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 (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 -// license : MIT; see accompanying LICENSE file - -include ; -include ; - -class base -{ - bool -b; - int -i = -1; - std::string -s; -}; - -class derived: base -{ - std::vector -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 <=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; -

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 - $* --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 <=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; -
-

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 -$* --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 <=test.cli; -" - -\N| -This is a note para one. - -\ -And this is a -pre-formatter text fragment. -\ - -| -" -EOI -$* --generate-html --stdout test.cli >>EOO; -
-

This is a note para one.

- -
And this is a
-pre-formatter text fragment.
-
- -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 <=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 <=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; -
    -
  • 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 -$* --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 <=test.cli; -" -This is normal text. \N{This is a note.} And this is normal text again. -" -EOI -$* --generate-html --stdout test.cli >>EOO; -

This is normal text. This is a note. And this - is normal text again.

- -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 <=test.cli; -" -\N{This is a note with a \l{https://example.com link} inside.} -" -EOI -$* --generate-html --stdout test.cli >>EOO; -

This is a note with a link inside.

- -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 -// 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/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 -// license : MIT; see accompanying LICENSE file - -include ; - -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 <=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 -

Table of Contents

- - - - - - -
Preface - - - -
About -This Document
More -Information
-
PART I
1Introduction - - - -
1.1Architecture and -Workflow
1.2Benefits
-
2Hello World - - - - -
2.1Setup
2.2Compiling - - - -
2.2.1Compiling with -GCC
2.2.2Compiling -with Clang
-
2.3Conclusion
-
- -

Preface

- -

This document describes something awesome.

- -

About This Document

- -

And this document is also awesome.

- -

More Information

- -

It is so awesome that no further information will be required.

- -

PART I

- -

Start of part one.

- -

1 Introduction

- -

Beginning of the first chapter.

- -

1.1 Architecture and Workflow

- -

Some basics.

- -

1.2 Benefits

- -

You will like them.

- -

2 Hello World

- -

Beginning of the second chapter.

- -

2.1 Setup

- -

More basics.

- -

2.2 Compiling

- -

How to build the example

- -

2.2.1 Compiling with GCC

- -

GCC. For Clang see Compiling with - Clang.

- -

2.2.2 Compiling with Clang

- -

Clang. For GCC see Compiling with - GCC.

- -

2.3 Conclusion

- -

Some remarks.

- -EOO -- cgit v1.1