summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buildfile24
-rw-r--r--cli/context.cxx8
-rw-r--r--cli/header.cxx10
-rw-r--r--cli/parser.cxx2
-rw-r--r--cli/txt.cxx4
-rw-r--r--examples/.gitignore1
-rw-r--r--examples/build/.gitignore1
-rw-r--r--examples/build/bootstrap.build9
-rw-r--r--examples/build/root.build27
-rw-r--r--examples/buildfile7
-rw-r--r--examples/features/.gitignore1
-rw-r--r--examples/features/buildfile11
-rw-r--r--examples/features/makefile72
-rw-r--r--examples/file/.gitignore1
-rw-r--r--examples/file/buildfile14
-rw-r--r--examples/file/makefile74
-rw-r--r--examples/hello/.gitignore1
-rw-r--r--examples/hello/buildfile12
-rw-r--r--examples/hello/makefile72
-rw-r--r--tests/.gitignore2
-rw-r--r--tests/build/.gitignore1
-rw-r--r--tests/build/bootstrap.build9
-rw-r--r--tests/build/root.build27
-rw-r--r--tests/buildfile7
-rw-r--r--tests/ctor/buildfile11
-rw-r--r--tests/ctor/makefile72
-rw-r--r--tests/erase/buildfile12
-rw-r--r--tests/erase/makefile72
-rw-r--r--tests/file/base.ops2
-rw-r--r--tests/file/buildfile13
-rw-r--r--tests/file/driver.cxx2
-rw-r--r--tests/file/empty.ops3
-rw-r--r--tests/file/makefile99
-rw-r--r--tests/file/test-000.ops6
-rw-r--r--tests/file/test-000.std18
-rw-r--r--tests/file/test-001.ops3
-rw-r--r--tests/file/test-001.std6
-rw-r--r--tests/file/test-002.ops7
-rw-r--r--tests/file/test-002.std17
-rw-r--r--tests/file/test-003.std7
-rw-r--r--tests/file/test-004.ops17
-rw-r--r--tests/file/test-004.std32
-rw-r--r--tests/file/test-005.ops1
-rw-r--r--tests/file/test-005.std1
-rw-r--r--tests/file/test-006.ops1
-rw-r--r--tests/file/test-006.std1
-rw-r--r--tests/file/test-007.ops1
-rw-r--r--tests/file/test-007.std1
-rw-r--r--tests/file/test-008.ops1
-rw-r--r--tests/file/test-008.std1
-rw-r--r--tests/file/test-009.ops1
-rw-r--r--tests/file/test-009.std1
-rw-r--r--tests/file/test-010.ops1
-rw-r--r--tests/file/test-010.std1
-rw-r--r--tests/file/test-011.ops1
-rw-r--r--tests/file/test-011.std1
-rw-r--r--tests/file/test-012.ops1
-rw-r--r--tests/file/test-012.std1
-rw-r--r--tests/file/testscript241
-rw-r--r--tests/headings/buildfile5
-rw-r--r--tests/headings/map.cli15
-rw-r--r--tests/headings/map.html12
-rw-r--r--tests/headings/testscript39
-rw-r--r--tests/inheritance/buildfile15
-rw-r--r--tests/inheritance/makefile76
-rw-r--r--tests/lexer/makefile77
-rw-r--r--tests/lexer/test-000.cli11
-rw-r--r--tests/lexer/test-000.std12
-rw-r--r--tests/lexer/test-001.cli6
-rw-r--r--tests/lexer/test-001.std6
-rw-r--r--tests/lexer/test-002.cli7
-rw-r--r--tests/lexer/test-002.std8
-rw-r--r--tests/lexer/test-003.cli13
-rw-r--r--tests/lexer/test-003.std24
-rw-r--r--tests/lexer/test-004.cli5
-rw-r--r--tests/lexer/test-004.std15
-rw-r--r--tests/lexer/test-005.cli2
-rw-r--r--tests/lexer/test-005.std3
-rw-r--r--tests/lexer/test-006.cli16
-rw-r--r--tests/lexer/test-006.std9
-rw-r--r--tests/parser/makefile94
-rw-r--r--tests/parser/test-000.cli5
-rw-r--r--tests/parser/test-000.std0
-rw-r--r--tests/parser/test-001-base.cli0
-rw-r--r--tests/parser/test-001-common.cli1
-rw-r--r--tests/parser/test-001.cli6
-rw-r--r--tests/parser/test-001.std0
-rw-r--r--tests/parser/test-002.cli15
-rw-r--r--tests/parser/test-002.std0
-rw-r--r--tests/parser/test-003.cli23
-rw-r--r--tests/parser/test-003.std0
-rw-r--r--tests/parser/test-004.cli8
-rw-r--r--tests/parser/test-004.std0
-rw-r--r--tests/parser/test-005.cli67
-rw-r--r--tests/parser/test-005.std0
-rw-r--r--tests/parser/test-006.cli16
-rw-r--r--tests/parser/test-006.std0
-rw-r--r--tests/parser/test-007-base.cli11
-rw-r--r--tests/parser/test-007.cli30
-rw-r--r--tests/parser/test-007.std0
-rw-r--r--tests/specifier/buildfile14
-rw-r--r--tests/specifier/makefile73
-rw-r--r--tests/toc/buildfile5
-rw-r--r--tests/toc/testscript (renamed from tests/toc/toc.html)78
-rw-r--r--tests/toc/toc.cli57
-rw-r--r--unit-tests/.gitignore1
-rw-r--r--unit-tests/buildfile7
-rw-r--r--unit-tests/lexer/buildfile12
-rw-r--r--unit-tests/lexer/driver.cxx (renamed from tests/lexer/driver.cxx)6
-rw-r--r--unit-tests/lexer/testscript192
-rw-r--r--unit-tests/parser/buildfile14
-rw-r--r--unit-tests/parser/driver.cxx (renamed from tests/parser/driver.cxx)8
-rw-r--r--unit-tests/parser/testscript243
113 files changed, 1069 insertions, 1346 deletions
diff --git a/buildfile b/buildfile
index a4a8411..2cf31c3 100644
--- a/buildfile
+++ b/buildfile
@@ -2,11 +2,27 @@
# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
# license : MIT; see accompanying LICENSE file
-d = cli/
+d = cli/ unit-tests/
+
+# Building examples/ and tests/ while bootstrapping the compiler is tricky.
+# What we are going to do is omit these two directories if there is no cli
+# compiler yet. Once it's built the user can reconfigure the project which
+# will enable tests and examples. Alternatively, the user can install the
+# compiler and test the installation with out-of-tree builds of tests/ and
+# examples/.
+#
+# @@ A problem with this approach is an old cli compiler installed in the
+# system -- it will be used for the project including tests and examples.
+#
+if $cli.configured
+ d += tests/ examples/
+
./: $d doc{INSTALL LICENSE NEWS README version} file{manifest}
include $d
-# Don't install tests or the INSTALL file.
+# Don't install examples, tests or the INSTALL file.
#
-dir{tests/}: install = false
-doc{INSTALL}@./: install = false
+dir{examples/}: install = false
+dir{tests/}: install = false
+dir{unit-tests/}: install = false
+doc{INSTALL}@./: install = false
diff --git a/cli/context.cxx b/cli/context.cxx
index 7cec6e3..1c70cc7 100644
--- a/cli/context.cxx
+++ b/cli/context.cxx
@@ -404,8 +404,8 @@ format_line (output_type ot, string& r, const char* s, size_t n)
vector<block> blocks;
string link_target;
- string link_section; // If not empty, man section; target is man name.
- bool link_empty; // Link has no text.
+ string link_section; // If not empty, man section; target is man name.
+ bool link_empty (false); // Link has no text.
bool escape (false);
for (size_t i (0); i < n; ++i)
@@ -1186,7 +1186,7 @@ format (semantics::scope& scope, string const& s, bool para)
// Number of li in ol. Since we don't support nested lists, we don't
// need to push it into the stack.
//
- size_t ol_count;
+ size_t ol_count (0);
// Mapping of \h to HTML tag. By default it is <h1> until we encounter
// \h0 or \h1 at which point we change it to <h2>.
@@ -1283,7 +1283,7 @@ format (semantics::scope& scope, string const& s, bool para)
// First determine what kind of paragraph block this is.
//
- block::kind_type k;
+ block::kind_type k (block::h);
string id;
string header;
string trailer;
diff --git a/cli/header.cxx b/cli/header.cxx
index 41bdab5..41ff3c5 100644
--- a/cli/header.cxx
+++ b/cli/header.cxx
@@ -272,11 +272,11 @@ namespace
//
//
- struct includes: traversal::cxx_includes,
- traversal::cli_includes,
- context
+ struct includes_: traversal::cxx_includes,
+ traversal::cli_includes,
+ context
{
- includes (context& c) : context (c) {}
+ includes_ (context& c) : context (c) {}
virtual void
traverse (semantics::cxx_includes& i)
@@ -318,7 +318,7 @@ generate_header (context& ctx)
ostream& os (ctx.os);
traversal::cli_unit unit;
- includes includes (ctx);
+ includes_ includes (ctx);
traversal::names unit_names;
namespace_ ns (ctx);
class_ cl (ctx);
diff --git a/cli/parser.cxx b/cli/parser.cxx
index d8c11c5..cdc421b 100644
--- a/cli/parser.cxx
+++ b/cli/parser.cxx
@@ -1155,7 +1155,7 @@ doc_string (const char* l, size_t n)
size_t b (0), e, p;
bool pre (false);
- size_t m; // Number of leading spaces to remove in pre.
+ size_t m (0); // Number of leading spaces to remove in pre.
while (more)
{
diff --git a/cli/txt.cxx b/cli/txt.cxx
index 9fbfb27..cff6dc1 100644
--- a/cli/txt.cxx
+++ b/cli/txt.cxx
@@ -171,7 +171,7 @@ namespace
struct option: traversal::option, context
{
- option (context& c, class_doc_type cd) : context (c), cd_ (cd) {}
+ option (context& c, class_doc_type) : context (c)/*, cd_ (cd)*/ {}
virtual void
traverse (type& o)
@@ -187,7 +187,7 @@ namespace
}
private:
- class_doc_type cd_;
+ // class_doc_type cd_;
};
//
diff --git a/examples/.gitignore b/examples/.gitignore
new file mode 100644
index 0000000..e54525b
--- /dev/null
+++ b/examples/.gitignore
@@ -0,0 +1 @@
+driver
diff --git a/examples/build/.gitignore b/examples/build/.gitignore
new file mode 100644
index 0000000..225c27f
--- /dev/null
+++ b/examples/build/.gitignore
@@ -0,0 +1 @@
+config.build
diff --git a/examples/build/bootstrap.build b/examples/build/bootstrap.build
new file mode 100644
index 0000000..c67bb12
--- /dev/null
+++ b/examples/build/bootstrap.build
@@ -0,0 +1,9 @@
+# file : examples/build/bootstrap.build
+# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+# license : MIT; see accompanying LICENSE file
+
+project = # Unnamed subproject.
+
+using config
+using dist
+using test
diff --git a/examples/build/root.build b/examples/build/root.build
new file mode 100644
index 0000000..8c33a1c
--- /dev/null
+++ b/examples/build/root.build
@@ -0,0 +1,27 @@
+# file : examples/build/root.build
+# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+# license : MIT; see accompanying LICENSE file
+
+cxx.std = 11
+
+using cxx
+
+hxx{*}: extension = hxx
+ixx{*}: extension = ixx
+txx{*}: extension = txx
+cxx{*}: extension = cxx
+
+# Load cli module. It must be available from the system or from the base
+# project. Generating files with cli is a part of the examples, 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
diff --git a/examples/buildfile b/examples/buildfile
new file mode 100644
index 0000000..3bd38c8
--- /dev/null
+++ b/examples/buildfile
@@ -0,0 +1,7 @@
+# file : examples/buildfile
+# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+# license : MIT; see accompanying LICENSE file
+
+d = features/ file/ hello/
+./: $d doc{README}
+include $d
diff --git a/examples/features/.gitignore b/examples/features/.gitignore
new file mode 100644
index 0000000..c6e608b
--- /dev/null
+++ b/examples/features/.gitignore
@@ -0,0 +1 @@
+options.?xx
diff --git a/examples/features/buildfile b/examples/features/buildfile
new file mode 100644
index 0000000..3b7b1dc
--- /dev/null
+++ b/examples/features/buildfile
@@ -0,0 +1,11 @@
+# file : examples/features/buildfile
+# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+# license : MIT; see accompanying LICENSE file
+
+exe{driver}: cxx{driver} {hxx ixx cxx}{options} doc{README}
+
+cxx.poptions =+ -I$out_base
+
+# Generated options parser.
+#
+{hxx ixx cxx}{options}: cli{options}
diff --git a/examples/features/makefile b/examples/features/makefile
deleted file mode 100644
index 9b7ceac..0000000
--- a/examples/features/makefile
+++ /dev/null
@@ -1,72 +0,0 @@
-# file : examples/features/makefile
-# author : Boris Kolpackov <boris@codesynthesis.com>
-# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
-# license : MIT; see accompanying LICENSE file
-
-include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
-
-cli := options.cli
-cxx := driver.cxx
-
-obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(cli:.cli=.o))
-dep := $(obj:.o=.o.d)
-
-driver := $(out_base)/driver
-install := $(out_base)/.install
-clean := $(out_base)/.clean
-
-# Build.
-#
-$(driver): $(obj)
-
-$(obj) $(dep): cpp_options := -I$(out_base)
-
-genf := $(cli:.cli=.hxx) $(cli:.cli=.ixx) $(cli:.cli=.cxx)
-gen := $(addprefix $(out_base)/,$(genf))
-
-$(gen): cli := $(out_root)/cli/cli
-$(gen): $(out_root)/cli/cli
-
-$(call include-dep,$(dep),$(obj),$(gen))
-
-# Convenience alias for default target.
-#
-$(out_base)/: $(driver)
-
-# Install
-#
-$(install): path := $(subst $(src_root)/,,$(src_base))
-$(install):
- $(call install-data,$(src_base)/driver.cxx,$(install_doc_dir)/cli/$(path)/driver.cxx)
- $(call install-data,$(src_base)/options.cli,$(install_doc_dir)/cli/$(path)/options.cli)
- $(call install-data,$(src_base)/README,$(install_doc_dir)/cli/$(path)/README)
-
-# Clean.
-#
-$(clean): $(driver).o.clean \
- $(addsuffix .cxx.clean,$(obj)) \
- $(addsuffix .cxx.clean,$(dep)) \
- $(addprefix $(out_base)/,$(cli:.cli=.cxx.cli.clean))
-
-# Generated .gitignore.
-#
-ifeq ($(out_base),$(src_base))
-$(gen): | $(out_base)/.gitignore
-$(driver): | $(out_base)/.gitignore
-
-$(out_base)/.gitignore: files := driver $(genf)
-$(clean): $(out_base)/.gitignore.clean
-
-$(call include,$(bld_root)/git/gitignore.make)
-endif
-
-# How to.
-#
-$(call include,$(bld_root)/cxx/o-e.make)
-$(call include,$(bld_root)/cxx/cxx-o.make)
-$(call include,$(bld_root)/cxx/cxx-d.make)
-$(call include,$(scf_root)/cli/cli-cxx.make)
-
-# Dependencies.
-#
-$(call import,$(src_root)/cli/makefile)
diff --git a/examples/file/.gitignore b/examples/file/.gitignore
new file mode 100644
index 0000000..c6e608b
--- /dev/null
+++ b/examples/file/.gitignore
@@ -0,0 +1 @@
+options.?xx
diff --git a/examples/file/buildfile b/examples/file/buildfile
new file mode 100644
index 0000000..d26a9d6
--- /dev/null
+++ b/examples/file/buildfile
@@ -0,0 +1,14 @@
+# file : examples/file/buildfile
+# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+# license : MIT; see accompanying LICENSE file
+
+exe{driver}: cxx{driver} {hxx ixx cxx}{options} doc{README} file{test.ops}
+exe{driver}: test.arguments = --options-file $src_base/test.ops
+
+cxx.poptions =+ -I$out_base
+
+# Generated options parser.
+#
+{hxx ixx cxx}{options}: cli{options}
+
+cli.options = --generate-file-scanner
diff --git a/examples/file/makefile b/examples/file/makefile
deleted file mode 100644
index ba1a760..0000000
--- a/examples/file/makefile
+++ /dev/null
@@ -1,74 +0,0 @@
-# file : examples/file/makefile
-# author : Boris Kolpackov <boris@codesynthesis.com>
-# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
-# license : MIT; see accompanying LICENSE file
-
-include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
-
-cli := options.cli
-cxx := driver.cxx
-
-obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(cli:.cli=.o))
-dep := $(obj:.o=.o.d)
-
-driver := $(out_base)/driver
-install := $(out_base)/.install
-clean := $(out_base)/.clean
-
-# Build.
-#
-$(driver): $(obj)
-
-$(obj) $(dep): cpp_options := -I$(out_base)
-
-genf := $(cli:.cli=.hxx) $(cli:.cli=.ixx) $(cli:.cli=.cxx)
-gen := $(addprefix $(out_base)/,$(genf))
-
-$(gen): cli := $(out_root)/cli/cli
-$(gen): cli_options += --generate-file-scanner
-$(gen): $(out_root)/cli/cli
-
-$(call include-dep,$(dep),$(obj),$(gen))
-
-# Convenience alias for default target.
-#
-$(out_base)/: $(driver)
-
-# Install
-#
-$(install): path := $(subst $(src_root)/,,$(src_base))
-$(install):
- $(call install-data,$(src_base)/driver.cxx,$(install_doc_dir)/cli/$(path)/driver.cxx)
- $(call install-data,$(src_base)/options.cli,$(install_doc_dir)/cli/$(path)/options.cli)
- $(call install-data,$(src_base)/README,$(install_doc_dir)/cli/$(path)/README)
- $(call install-data,$(src_base)/test.ops,$(install_doc_dir)/cli/$(path)/test.ops)
-
-# Clean.
-#
-$(clean): $(driver).o.clean \
- $(addsuffix .cxx.clean,$(obj)) \
- $(addsuffix .cxx.clean,$(dep)) \
- $(addprefix $(out_base)/,$(cli:.cli=.cxx.cli.clean))
-
-# Generated .gitignore.
-#
-ifeq ($(out_base),$(src_base))
-$(gen): | $(out_base)/.gitignore
-$(driver): | $(out_base)/.gitignore
-
-$(out_base)/.gitignore: files := driver $(genf)
-$(clean): $(out_base)/.gitignore.clean
-
-$(call include,$(bld_root)/git/gitignore.make)
-endif
-
-# How to.
-#
-$(call include,$(bld_root)/cxx/o-e.make)
-$(call include,$(bld_root)/cxx/cxx-o.make)
-$(call include,$(bld_root)/cxx/cxx-d.make)
-$(call include,$(scf_root)/cli/cli-cxx.make)
-
-# Dependencies.
-#
-$(call import,$(src_root)/cli/makefile)
diff --git a/examples/hello/.gitignore b/examples/hello/.gitignore
new file mode 100644
index 0000000..d73130a
--- /dev/null
+++ b/examples/hello/.gitignore
@@ -0,0 +1 @@
+hello.?xx
diff --git a/examples/hello/buildfile b/examples/hello/buildfile
new file mode 100644
index 0000000..f45001d
--- /dev/null
+++ b/examples/hello/buildfile
@@ -0,0 +1,12 @@
+# file : examples/hello/buildfile
+# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+# license : MIT; see accompanying LICENSE file
+
+exe{driver}: cxx{driver} {hxx ixx cxx}{hello} doc{README}
+exe{driver}: test.arguments = --greeting Hi John Jane
+
+cxx.poptions =+ -I$out_base
+
+# Generated options parser.
+#
+{hxx ixx cxx}{hello}: cli{hello}
diff --git a/examples/hello/makefile b/examples/hello/makefile
deleted file mode 100644
index cd8d29d..0000000
--- a/examples/hello/makefile
+++ /dev/null
@@ -1,72 +0,0 @@
-# file : examples/hello/makefile
-# author : Boris Kolpackov <boris@codesynthesis.com>
-# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
-# license : MIT; see accompanying LICENSE file
-
-include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
-
-cli := hello.cli
-cxx := driver.cxx
-
-obj := $(addprefix $(out_base)/,$(cxx:.cxx=.o) $(cli:.cli=.o))
-dep := $(obj:.o=.o.d)
-
-driver := $(out_base)/driver
-install := $(out_base)/.install
-clean := $(out_base)/.clean
-
-# Build.
-#
-$(driver): $(obj)
-
-$(obj) $(dep): cpp_options := -I$(out_base)
-
-genf := $(cli:.cli=.hxx) $(cli:.cli=.ixx) $(cli:.cli=.cxx)
-gen := $(addprefix $(out_base)/,$(genf))
-
-$(gen): cli := $(out_root)/cli/cli
-$(gen): $(out_root)/cli/cli
-
-$(call include-dep,$(dep),$(obj),$(gen))
-
-# Convenience alias for default target.
-#
-$(out_base)/: $(driver)
-
-# Install
-#
-$(install): path := $(subst $(src_root)/,,$(src_base))
-$(install):
- $(call install-data,$(src_base)/driver.cxx,$(install_doc_dir)/cli/$(path)/driver.cxx)
- $(call install-data,$(src_base)/hello.cli,$(install_doc_dir)/cli/$(path)/hello.cli)
- $(call install-data,$(src_base)/README,$(install_doc_dir)/cli/$(path)/README)
-
-# Clean.
-#
-$(clean): $(driver).o.clean \
- $(addsuffix .cxx.clean,$(obj)) \
- $(addsuffix .cxx.clean,$(dep)) \
- $(addprefix $(out_base)/,$(cli:.cli=.cxx.cli.clean))
-
-# Generated .gitignore.
-#
-ifeq ($(out_base),$(src_base))
-$(gen): | $(out_base)/.gitignore
-$(driver): | $(out_base)/.gitignore
-
-$(out_base)/.gitignore: files := driver $(genf)
-$(clean): $(out_base)/.gitignore.clean
-
-$(call include,$(bld_root)/git/gitignore.make)
-endif
-
-# How to.
-#
-$(call include,$(bld_root)/cxx/o-e.make)
-$(call include,$(bld_root)/cxx/cxx-o.make)
-$(call include,$(bld_root)/cxx/cxx-d.make)
-$(call include,$(scf_root)/cli/cli-cxx.make)
-
-# Dependencies.
-#
-$(call import,$(src_root)/cli/makefile)
diff --git a/tests/.gitignore b/tests/.gitignore
new file mode 100644
index 0000000..3381565
--- /dev/null
+++ b/tests/.gitignore
@@ -0,0 +1,2 @@
+driver
+test.?xx
diff --git a/tests/build/.gitignore b/tests/build/.gitignore
new file mode 100644
index 0000000..225c27f
--- /dev/null
+++ b/tests/build/.gitignore
@@ -0,0 +1 @@
+config.build
diff --git a/tests/build/bootstrap.build b/tests/build/bootstrap.build
new file mode 100644
index 0000000..904c361
--- /dev/null
+++ b/tests/build/bootstrap.build
@@ -0,0 +1,9 @@
+# file : tests/build/bootstrap.build
+# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+# 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
new file mode 100644
index 0000000..b503d3f
--- /dev/null
+++ b/tests/build/root.build
@@ -0,0 +1,27 @@
+# file : tests/build/root.build
+# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+# license : MIT; see accompanying LICENSE file
+
+cxx.std = 11
+
+using cxx
+
+hxx{*}: extension = hxx
+ixx{*}: extension = ixx
+txx{*}: extension = txx
+cxx{*}: extension = cxx
+
+# 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
diff --git a/tests/buildfile b/tests/buildfile
new file mode 100644
index 0000000..dbb3a22
--- /dev/null
+++ b/tests/buildfile
@@ -0,0 +1,7 @@
+# file : tests/buildfile
+# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+# license : MIT; see accompanying LICENSE file
+
+d = ctor/ erase/ file/ headings/ inheritance/ specifier/ toc/
+./: $d
+include $d
diff --git a/tests/ctor/buildfile b/tests/ctor/buildfile
new file mode 100644
index 0000000..ce0dc03
--- /dev/null
+++ b/tests/ctor/buildfile
@@ -0,0 +1,11 @@
+# file : tests/ctor/buildfile
+# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+# license : MIT; see accompanying LICENSE file
+
+exe{driver}: cxx{driver} {hxx ixx cxx}{test}
+
+cxx.poptions =+ -I$out_base
+
+# Generated options parser.
+#
+{hxx ixx cxx}{test}: cli{test}
diff --git a/tests/ctor/makefile b/tests/ctor/makefile
deleted file mode 100644
index d50c32d..0000000
--- a/tests/ctor/makefile
+++ /dev/null
@@ -1,72 +0,0 @@
-# file : tests/ctor/makefile
-# author : Boris Kolpackov <boris@codesynthesis.com>
-# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
-# license : MIT; see accompanying LICENSE file
-
-include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
-
-cxx_tun := driver.cxx
-cli_tun := test.cli
-
-#
-#
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(cli_tun:.cli=.o))
-cxx_od := $(cxx_obj:.o=.o.d)
-
-driver := $(out_base)/driver
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
-# Build.
-#
-$(driver): $(cxx_obj)
-$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base)
-
-genf := $(cli_tun:.cli=.hxx) $(cli_tun:.cli=.ixx) $(cli_tun:.cli=.cxx)
-gen := $(addprefix $(out_base)/,$(genf))
-
-$(gen): $(out_root)/cli/cli
-$(gen): cli := $(out_root)/cli/cli
-
-$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
-
-# Alias for default target.
-#
-$(out_base)/: $(driver)
-
-# Test.
-#
-$(test): driver := $(driver)
-$(test): $(driver)
- $(call message,test $$1,$$1,$(driver))
-
-# Clean.
-#
-$(clean): \
- $(driver).o.clean \
- $(addsuffix .cxx.clean,$(cxx_obj)) \
- $(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(cli_tun:.cli=.cxx.cli.clean))
-
-# Generated .gitignore.
-#
-ifeq ($(out_base),$(src_base))
-$(driver): | $(out_base)/.gitignore
-
-$(out_base)/.gitignore: files := driver $(genf)
-$(clean): $(out_base)/.gitignore.clean
-
-$(call include,$(bld_root)/git/gitignore.make)
-endif
-
-# How to.
-#
-$(call include,$(bld_root)/cxx/o-e.make)
-$(call include,$(bld_root)/cxx/cxx-o.make)
-$(call include,$(bld_root)/cxx/cxx-d.make)
-$(call include,$(scf_root)/cli/cli-cxx.make)
-
-# Dependencies.
-#
-$(call import,$(src_root)/cli/makefile)
-
diff --git a/tests/erase/buildfile b/tests/erase/buildfile
new file mode 100644
index 0000000..887c9d9
--- /dev/null
+++ b/tests/erase/buildfile
@@ -0,0 +1,12 @@
+# file : tests/erase/buildfile
+# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+# license : MIT; see accompanying LICENSE file
+
+exe{driver}: cxx{driver} {hxx ixx cxx}{test}
+exe{driver}: test.arguments = foo -a bar -b 123 --arg -- -b 234
+
+cxx.poptions =+ -I$out_base
+
+# Generated options parser.
+#
+{hxx ixx cxx}{test}: cli{test}
diff --git a/tests/erase/makefile b/tests/erase/makefile
deleted file mode 100644
index ef26ed7..0000000
--- a/tests/erase/makefile
+++ /dev/null
@@ -1,72 +0,0 @@
-# file : tests/erase/makefile
-# author : Boris Kolpackov <boris@codesynthesis.com>
-# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
-# license : MIT; see accompanying LICENSE file
-
-include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
-
-cxx_tun := driver.cxx
-cli_tun := test.cli
-
-#
-#
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(cli_tun:.cli=.o))
-cxx_od := $(cxx_obj:.o=.o.d)
-
-driver := $(out_base)/driver
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
-# Build.
-#
-$(driver): $(cxx_obj)
-$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base)
-
-genf := $(cli_tun:.cli=.hxx) $(cli_tun:.cli=.ixx) $(cli_tun:.cli=.cxx)
-gen := $(addprefix $(out_base)/,$(genf))
-
-$(gen): $(out_root)/cli/cli
-$(gen): cli := $(out_root)/cli/cli
-
-$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
-
-# Alias for default target.
-#
-$(out_base)/: $(driver)
-
-# Test.
-#
-$(test): driver := $(driver)
-$(test): $(driver)
- $(call message,test $$1,$$1 foo -a bar -b 123 --arg -- -b 234,$(driver))
-
-# Clean.
-#
-$(clean): \
- $(driver).o.clean \
- $(addsuffix .cxx.clean,$(cxx_obj)) \
- $(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(cli_tun:.cli=.cxx.cli.clean))
-
-# Generated .gitignore.
-#
-ifeq ($(out_base),$(src_base))
-$(driver): | $(out_base)/.gitignore
-
-$(out_base)/.gitignore: files := driver $(genf)
-$(clean): $(out_base)/.gitignore.clean
-
-$(call include,$(bld_root)/git/gitignore.make)
-endif
-
-# How to.
-#
-$(call include,$(bld_root)/cxx/o-e.make)
-$(call include,$(bld_root)/cxx/cxx-o.make)
-$(call include,$(bld_root)/cxx/cxx-d.make)
-$(call include,$(scf_root)/cli/cli-cxx.make)
-
-# Dependencies.
-#
-$(call import,$(src_root)/cli/makefile)
-
diff --git a/tests/file/base.ops b/tests/file/base.ops
deleted file mode 100644
index 45d7696..0000000
--- a/tests/file/base.ops
+++ /dev/null
@@ -1,2 +0,0 @@
--a 21
--b 21
diff --git a/tests/file/buildfile b/tests/file/buildfile
new file mode 100644
index 0000000..08e1017
--- /dev/null
+++ b/tests/file/buildfile
@@ -0,0 +1,13 @@
+# file : tests/file/buildfile
+# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+# license : MIT; see accompanying LICENSE file
+
+exe{driver}: cxx{driver} {hxx ixx cxx}{test} test{testscript}
+
+cxx.poptions =+ -I$out_base
+
+# Generated options parser.
+#
+{hxx ixx cxx}{test}: cli{test}
+
+cli.options = --generate-file-scanner
diff --git a/tests/file/driver.cxx b/tests/file/driver.cxx
index d0b5774..16609ec 100644
--- a/tests/file/driver.cxx
+++ b/tests/file/driver.cxx
@@ -24,6 +24,6 @@ main (int argc, char* argv[])
}
catch (const cli::exception& e)
{
- cout << e << endl;
+ cerr << e << endl;
}
}
diff --git a/tests/file/empty.ops b/tests/file/empty.ops
deleted file mode 100644
index ed080fb..0000000
--- a/tests/file/empty.ops
+++ /dev/null
@@ -1,3 +0,0 @@
-# Empty options file.
-#
-
diff --git a/tests/file/makefile b/tests/file/makefile
deleted file mode 100644
index 7e4df6a..0000000
--- a/tests/file/makefile
+++ /dev/null
@@ -1,99 +0,0 @@
-# file : tests/file/makefile
-# author : Boris Kolpackov <boris@codesynthesis.com>
-# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
-# license : MIT; see accompanying LICENSE file
-
-include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
-
-cxx_tun := driver.cxx
-cli_tun := test.cli
-
-tests := 000 001 002 003 004 005 006 007 008 009 010 011 012
-
-#
-#
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(cli_tun:.cli=.o))
-cxx_od := $(cxx_obj:.o=.o.d)
-
-driver := $(out_base)/driver
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
-# Build.
-#
-$(driver): $(cxx_obj)
-$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base)
-
-genf := $(cli_tun:.cli=.hxx) $(cli_tun:.cli=.ixx) $(cli_tun:.cli=.cxx)
-gen := $(addprefix $(out_base)/,$(genf))
-
-$(gen): $(out_root)/cli/cli
-$(gen): cli := $(out_root)/cli/cli
-$(gen): cli_options += --generate-file-scanner
-
-$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
-
-# Alias for default target.
-#
-$(out_base)/: $(driver)
-
-# Test.
-#
-test_targets := $(addprefix $(out_base)/.test-,$(tests))
-
-$(test): $(test_targets)
-$(test_targets): driver := $(driver)
-
-.PHONY: $(out_base)/.test-%
-
-$(out_base)/.test-000: $(driver) $(src_base)/test-000.ops
- $(call message,test $(out_base)/000,$(driver) -a 1 \
---file $(src_base)/empty.ops -b 1 --file $(src_base)/base.ops \
---file $(src_base)/test-000.ops b | diff -u $(src_base)/test-000.std -)
-
-$(out_base)/.test-001: $(driver) $(src_base)/test-001.ops
- $(call message,test $(out_base)/001,$(driver) -a 1 -- --file \
-test-001.ops b | diff -u $(src_base)/test-001.std -)
-
-$(out_base)/.test-002: $(driver) $(src_base)/test-002.ops
- $(call message,test $(out_base)/002,$(driver) -a 1 --file \
-$(src_base)/test-002.ops --file empty.ops b | diff -u $(src_base)/test-002.std -)
-
-$(out_base)/.test-003: $(driver)
- $(call message,test $(out_base)/003,$(driver) -a 1 --file \
-$(src_base)/base.ops --file test-003.ops b | diff -u $(src_base)/test-003.std -)
-
-$(out_base)/.test-%: $(driver) $(src_base)/test-%.ops $(src_base)/test-%.std
- $(call message,test $(out_base)/$*,$(driver) --file \
-$(src_base)/test-$*.ops | diff -u $(src_base)/test-$*.std -)
-
-# Clean.
-#
-$(clean): \
- $(driver).o.clean \
- $(addsuffix .cxx.clean,$(cxx_obj)) \
- $(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(cli_tun:.cli=.cxx.cli.clean))
-
-# Generated .gitignore.
-#
-ifeq ($(out_base),$(src_base))
-$(driver): | $(out_base)/.gitignore
-
-$(out_base)/.gitignore: files := driver $(genf)
-$(clean): $(out_base)/.gitignore.clean
-
-$(call include,$(bld_root)/git/gitignore.make)
-endif
-
-# How to.
-#
-$(call include,$(bld_root)/cxx/o-e.make)
-$(call include,$(bld_root)/cxx/cxx-o.make)
-$(call include,$(bld_root)/cxx/cxx-d.make)
-$(call include,$(scf_root)/cli/cli-cxx.make)
-
-# Dependencies.
-#
-$(call import,$(src_root)/cli/makefile)
-
diff --git a/tests/file/test-000.ops b/tests/file/test-000.ops
deleted file mode 100644
index c0462e2..0000000
--- a/tests/file/test-000.ops
+++ /dev/null
@@ -1,6 +0,0 @@
--a 11
--b 11
- -a 12
-
- -b 12
-a
diff --git a/tests/file/test-000.std b/tests/file/test-000.std
deleted file mode 100644
index 392b83d..0000000
--- a/tests/file/test-000.std
+++ /dev/null
@@ -1,18 +0,0 @@
--a
-1
--b
-1
--a
-21
--b
-21
--a
-11
--b
-11
--a
-12
--b
-12
-a
-b
diff --git a/tests/file/test-001.ops b/tests/file/test-001.ops
deleted file mode 100644
index ed080fb..0000000
--- a/tests/file/test-001.ops
+++ /dev/null
@@ -1,3 +0,0 @@
-# Empty options file.
-#
-
diff --git a/tests/file/test-001.std b/tests/file/test-001.std
deleted file mode 100644
index 8dec5e4..0000000
--- a/tests/file/test-001.std
+++ /dev/null
@@ -1,6 +0,0 @@
--a
-1
---
---file
-test-001.ops
-b
diff --git a/tests/file/test-002.ops b/tests/file/test-002.ops
deleted file mode 100644
index 5c728a0..0000000
--- a/tests/file/test-002.ops
+++ /dev/null
@@ -1,7 +0,0 @@
--a 11
--b 11
---
---file base.ops
--a 12
--b 12
-a
diff --git a/tests/file/test-002.std b/tests/file/test-002.std
deleted file mode 100644
index cd99b20..0000000
--- a/tests/file/test-002.std
+++ /dev/null
@@ -1,17 +0,0 @@
--a
-1
--a
-11
--b
-11
---
---file
-base.ops
--a
-12
--b
-12
-a
---file
-empty.ops
-b
diff --git a/tests/file/test-003.std b/tests/file/test-003.std
deleted file mode 100644
index 6e9a6ae..0000000
--- a/tests/file/test-003.std
+++ /dev/null
@@ -1,7 +0,0 @@
--a
-1
--a
-21
--b
-21
-unable to open file 'test-003.ops' or read failure
diff --git a/tests/file/test-004.ops b/tests/file/test-004.ops
deleted file mode 100644
index dee1b30..0000000
--- a/tests/file/test-004.ops
+++ /dev/null
@@ -1,17 +0,0 @@
--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 '"'
diff --git a/tests/file/test-004.std b/tests/file/test-004.std
deleted file mode 100644
index b06e8b9..0000000
--- a/tests/file/test-004.std
+++ /dev/null
@@ -1,32 +0,0 @@
--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
-"
diff --git a/tests/file/test-005.ops b/tests/file/test-005.ops
deleted file mode 100644
index c9acf33..0000000
--- a/tests/file/test-005.ops
+++ /dev/null
@@ -1 +0,0 @@
--a "
diff --git a/tests/file/test-005.std b/tests/file/test-005.std
deleted file mode 100644
index 52b6e89..0000000
--- a/tests/file/test-005.std
+++ /dev/null
@@ -1 +0,0 @@
-unmatched quote in argument '"'
diff --git a/tests/file/test-006.ops b/tests/file/test-006.ops
deleted file mode 100644
index 454366d..0000000
--- a/tests/file/test-006.ops
+++ /dev/null
@@ -1 +0,0 @@
--a "abc
diff --git a/tests/file/test-006.std b/tests/file/test-006.std
deleted file mode 100644
index 903f7a7..0000000
--- a/tests/file/test-006.std
+++ /dev/null
@@ -1 +0,0 @@
-unmatched quote in argument '"abc'
diff --git a/tests/file/test-007.ops b/tests/file/test-007.ops
deleted file mode 100644
index 8012af9..0000000
--- a/tests/file/test-007.ops
+++ /dev/null
@@ -1 +0,0 @@
--a abc"
diff --git a/tests/file/test-007.std b/tests/file/test-007.std
deleted file mode 100644
index fff8f85..0000000
--- a/tests/file/test-007.std
+++ /dev/null
@@ -1 +0,0 @@
-unmatched quote in argument 'abc"'
diff --git a/tests/file/test-008.ops b/tests/file/test-008.ops
deleted file mode 100644
index 773a366..0000000
--- a/tests/file/test-008.ops
+++ /dev/null
@@ -1 +0,0 @@
--a '
diff --git a/tests/file/test-008.std b/tests/file/test-008.std
deleted file mode 100644
index 5d74dc3..0000000
--- a/tests/file/test-008.std
+++ /dev/null
@@ -1 +0,0 @@
-unmatched quote in argument '''
diff --git a/tests/file/test-009.ops b/tests/file/test-009.ops
deleted file mode 100644
index 6c3d5c9..0000000
--- a/tests/file/test-009.ops
+++ /dev/null
@@ -1 +0,0 @@
--a 'abc
diff --git a/tests/file/test-009.std b/tests/file/test-009.std
deleted file mode 100644
index b212446..0000000
--- a/tests/file/test-009.std
+++ /dev/null
@@ -1 +0,0 @@
-unmatched quote in argument ''abc'
diff --git a/tests/file/test-010.ops b/tests/file/test-010.ops
deleted file mode 100644
index eb33825..0000000
--- a/tests/file/test-010.ops
+++ /dev/null
@@ -1 +0,0 @@
--a abc'
diff --git a/tests/file/test-010.std b/tests/file/test-010.std
deleted file mode 100644
index 868ee9d..0000000
--- a/tests/file/test-010.std
+++ /dev/null
@@ -1 +0,0 @@
-unmatched quote in argument 'abc''
diff --git a/tests/file/test-011.ops b/tests/file/test-011.ops
deleted file mode 100644
index 2330c9c..0000000
--- a/tests/file/test-011.ops
+++ /dev/null
@@ -1 +0,0 @@
--a "abc'
diff --git a/tests/file/test-011.std b/tests/file/test-011.std
deleted file mode 100644
index 2133ddf..0000000
--- a/tests/file/test-011.std
+++ /dev/null
@@ -1 +0,0 @@
-unmatched quote in argument '"abc''
diff --git a/tests/file/test-012.ops b/tests/file/test-012.ops
deleted file mode 100644
index d5efe67..0000000
--- a/tests/file/test-012.ops
+++ /dev/null
@@ -1 +0,0 @@
--a 'abc"
diff --git a/tests/file/test-012.std b/tests/file/test-012.std
deleted file mode 100644
index 2e85d39..0000000
--- a/tests/file/test-012.std
+++ /dev/null
@@ -1 +0,0 @@
-unmatched quote in argument ''abc"'
diff --git a/tests/file/testscript b/tests/file/testscript
new file mode 100644
index 0000000..3e7c18c
--- /dev/null
+++ b/tests/file/testscript
@@ -0,0 +1,241 @@
+# file : tests/file/testscript
+# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+# 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.cli
+# Empty options file.
+#
+
+EOI
++cat <<EOI >>>base.cli
+-a 21
+-b 21
+EOI
+
+# @@ Give tests some meaningfull descriptions.
+#
+
+: 000
+:
+cat <<EOI >>>test.cli;
+-a 11
+-b 11
+ -a 12
+
+ -b 12
+a
+EOI
+$* -a 1 --file ../empty.cli -b 1 --file ../base.cli --file test.cli 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.cli;
+# Empty options file.
+#
+
+EOI
+$* -a 1 -- --file test.cli b >>EOO
+-a
+1
+--
+--file
+test.cli
+b
+EOO
+
+: 002
+:
+cat <<EOI >>>test.cli;
+-a 11
+-b 11
+--
+--file ../base.cli
+-a 12
+-b 12
+a
+EOI
+$* -a 1 --file test.cli --file ../empty.cli b >>EOO
+-a
+1
+-a
+11
+-b
+11
+--
+--file
+../base.cli
+-a
+12
+-b
+12
+a
+--file
+../empty.cli
+b
+EOO
+
+: 003
+:
+$* -a 1 --file ../base.cli --file test.cli b >>EOO 2>>EOE
+-a
+1
+-a
+21
+-b
+21
+EOO
+unable to open file 'test.cli' or read failure
+EOE
+
+: 004
+:
+cat <<EOI >>>test.cli;
+-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.cli >>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.cli;
+-a "
+EOI
+$* --file test.cli 2>>EOE
+unmatched quote in argument '"'
+EOE
+
+: 006
+:
+cat <<EOI >>>test.cli;
+-a "abc
+EOI
+$* --file test.cli 2>>EOE
+unmatched quote in argument '"abc'
+EOE
+
+: 007
+:
+cat <<EOI >>>test.cli;
+-a abc"
+EOI
+$* --file test.cli 2>>EOE
+unmatched quote in argument 'abc"'
+EOE
+
+: 008
+:
+cat <<EOI >>>test.cli;
+-a '
+EOI
+$* --file test.cli 2>>EOE
+unmatched quote in argument '''
+EOE
+
+: 009
+:
+cat <<EOI >>>test.cli;
+-a 'abc
+EOI
+$* --file test.cli 2>>EOE
+unmatched quote in argument ''abc'
+EOE
+
+: 010
+:
+cat <<EOI >>>test.cli;
+-a abc'
+EOI
+$* --file test.cli 2>>EOE
+unmatched quote in argument 'abc''
+EOE
+
+: 011
+:
+cat <<EOI >>>test.cli;
+-a "abc'
+EOI
+$* --file test.cli 2>>EOE
+unmatched quote in argument '"abc''
+EOE
+
+: 012
+:
+cat <<EOI >>>test.cli;
+-a 'abc"
+EOI
+$* --file test.cli 2>>EOE
+unmatched quote in argument ''abc"'
+EOE
diff --git a/tests/headings/buildfile b/tests/headings/buildfile
new file mode 100644
index 0000000..d903d09
--- /dev/null
+++ b/tests/headings/buildfile
@@ -0,0 +1,5 @@
+# file : tests/headings/buildfile
+# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+# license : MIT; see accompanying LICENSE file
+
+./: test{testscript}
diff --git a/tests/headings/map.cli b/tests/headings/map.cli
deleted file mode 100644
index cdbec38..0000000
--- a/tests/headings/map.cli
+++ /dev/null
@@ -1,15 +0,0 @@
-// Note that auto-headings break if we split into multiple doc strings.
-//
-"
-\h1|Heading 1|
-
-\h|Heading 1.1|
-
-\h2|Heading 1.1.1|
-
-\h|Heading 1.2|
-
-\h2|Heading 1.2.1|
-
-\h1|Heading 2|
-"
diff --git a/tests/headings/map.html b/tests/headings/map.html
deleted file mode 100644
index f08086c..0000000
--- a/tests/headings/map.html
+++ /dev/null
@@ -1,12 +0,0 @@
- <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>
-
diff --git a/tests/headings/testscript b/tests/headings/testscript
new file mode 100644
index 0000000..0c31f99
--- /dev/null
+++ b/tests/headings/testscript
@@ -0,0 +1,39 @@
+# file : tests/headings/testscript
+# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+# 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
new file mode 100644
index 0000000..0f8bbcb
--- /dev/null
+++ b/tests/inheritance/buildfile
@@ -0,0 +1,15 @@
+# file : tests/erase/buildfile
+# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+# license : MIT; see accompanying LICENSE file
+
+exe{driver}: cxx{driver} {hxx ixx cxx}{test}
+exe{driver}: test.arguments = --very-long-flag -s short -i 123 --string long
+exe{driver}: test.output = test.std
+
+cxx.poptions =+ -I$out_base
+
+# Generated options parser.
+#
+{hxx ixx cxx}{test}: cli{test}
+
+cli.options = --generate-description --option-length 17
diff --git a/tests/inheritance/makefile b/tests/inheritance/makefile
deleted file mode 100644
index 3d99a99..0000000
--- a/tests/inheritance/makefile
+++ /dev/null
@@ -1,76 +0,0 @@
-# file : tests/inheritance/makefile
-# author : Boris Kolpackov <boris@codesynthesis.com>
-# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
-# license : MIT; see accompanying LICENSE file
-
-include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
-
-cxx_tun := driver.cxx
-cli_tun := test.cli
-
-#
-#
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(cli_tun:.cli=.o))
-cxx_od := $(cxx_obj:.o=.o.d)
-
-driver := $(out_base)/driver
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
-# Build.
-#
-$(driver): $(cxx_obj)
-$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base)
-
-genf := $(cli_tun:.cli=.hxx) $(cli_tun:.cli=.ixx) $(cli_tun:.cli=.cxx)
-gen := $(addprefix $(out_base)/,$(genf))
-
-$(gen): $(out_root)/cli/cli
-$(gen): cli := $(out_root)/cli/cli
-$(gen): cli_options := --generate-description --option-length 17
-
-$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
-
-# Alias for default target.
-#
-$(out_base)/: $(driver)
-
-# Test.
-#
-$(test): driver := $(driver)
-$(test): $(driver) $(src_base)/test.std
- $(call message,test $$1,$$1 --very-long-flag -s short -i 123 \
---string long >$(out_base)/test.out,$(driver))
- $(call message,,diff -u $(src_base)/test.std $(out_base)/test.out)
- $(call message,,rm -f $(out_base)/test.out)
-
-# Clean.
-#
-$(clean): \
- $(driver).o.clean \
- $(addsuffix .cxx.clean,$(cxx_obj)) \
- $(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(cli_tun:.cli=.cxx.cli.clean))
-
-# Generated .gitignore.
-#
-ifeq ($(out_base),$(src_base))
-$(driver): | $(out_base)/.gitignore
-
-$(out_base)/.gitignore: files := driver $(genf)
-$(clean): $(out_base)/.gitignore.clean
-
-$(call include,$(bld_root)/git/gitignore.make)
-endif
-
-# How to.
-#
-$(call include,$(bld_root)/cxx/o-e.make)
-$(call include,$(bld_root)/cxx/cxx-o.make)
-$(call include,$(bld_root)/cxx/cxx-d.make)
-$(call include,$(scf_root)/cli/cli-cxx.make)
-
-# Dependencies.
-#
-$(call import,$(src_root)/cli/makefile)
-
diff --git a/tests/lexer/makefile b/tests/lexer/makefile
deleted file mode 100644
index 80fceb8..0000000
--- a/tests/lexer/makefile
+++ /dev/null
@@ -1,77 +0,0 @@
-# file : tests/lexer/makefile
-# author : Boris Kolpackov <boris@codesynthesis.com>
-# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
-# license : MIT; see accompanying LICENSE file
-
-include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
-
-cxx_tun := driver.cxx
-
-tests := 000 001 002 003 004 005 006
-
-#
-#
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o))
-cxx_od := $(cxx_obj:.o=.o.d)
-
-driver := $(out_base)/driver
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
-# Import.
-#
-$(call import,\
- $(scf_root)/import/libcutl/stub.make,\
- l: cutl.l,cpp-options: cutl.l.cpp-options)
-
-# Build.
-#
-$(driver): $(cxx_obj) $(out_root)/cli/lexer.o $(cutl.l)
-
-$(cxx_obj) $(cxx_od): cpp_options := -I$(src_base) -I$(src_root)/cli
-$(cxx_obj) $(cxx_od): $(cutl.l.cpp-options)
-
-$(call include-dep,$(cxx_od))
-
-# Alias for default target.
-#
-$(out_base)/: $(driver)
-
-# Test.
-#
-test_targets := $(addprefix $(out_base)/.test-,$(tests))
-
-$(test): $(test_targets)
-$(test_targets): driver := $(driver)
-
-.PHONY: $(out_base)/.test-%
-$(out_base)/.test-%: $(driver) $(src_base)/test-%.cli $(src_base)/test-%.std
- $(call message,test $(out_base)/$*,$(driver) $(src_base)/test-$*.cli | diff -u $(src_base)/test-$*.std -)
-
-# Clean.
-#
-$(clean): \
- $(driver).o.clean \
- $(addsuffix .cxx.clean,$(cxx_obj)) \
- $(addsuffix .cxx.clean,$(cxx_od))
-
-# Generated .gitignore.
-#
-ifeq ($(out_base),$(src_base))
-$(driver): | $(out_base)/.gitignore
-
-$(out_base)/.gitignore: files := driver
-$(clean): $(out_base)/.gitignore.clean
-
-$(call include,$(bld_root)/git/gitignore.make)
-endif
-
-# How to.
-#
-$(call include,$(bld_root)/cxx/o-e.make)
-$(call include,$(bld_root)/cxx/cxx-o.make)
-$(call include,$(bld_root)/cxx/cxx-d.make)
-
-# Dependencies.
-#
-$(call import,$(src_root)/cli/makefile)
diff --git a/tests/lexer/test-000.cli b/tests/lexer/test-000.cli
deleted file mode 100644
index 68cf59f..0000000
--- a/tests/lexer/test-000.cli
+++ /dev/null
@@ -1,11 +0,0 @@
-help
-help-me
--h
---help
---help-me
---help-me-
-/h
-/help-me
-/help/me
---_
-
diff --git a/tests/lexer/test-000.std b/tests/lexer/test-000.std
deleted file mode 100644
index 9a44438..0000000
--- a/tests/lexer/test-000.std
+++ /dev/null
@@ -1,12 +0,0 @@
-identifier: help
-identifier: help-me
-identifier: -h
-identifier: --help
-identifier: --help-me
-identifier: --help-me-
-identifier: /h
-identifier: /help-me
-identifier: /help
-identifier: /me
-identifier: --_
-<EOS>
diff --git a/tests/lexer/test-001.cli b/tests/lexer/test-001.cli
deleted file mode 100644
index 6c2f917..0000000
--- a/tests/lexer/test-001.cli
+++ /dev/null
@@ -1,6 +0,0 @@
-5
-123456
--12345
-- 1
--
-123
diff --git a/tests/lexer/test-001.std b/tests/lexer/test-001.std
deleted file mode 100644
index 9732d65..0000000
--- a/tests/lexer/test-001.std
+++ /dev/null
@@ -1,6 +0,0 @@
-5
-123456
--12345
--1
--123
-<EOS>
diff --git a/tests/lexer/test-002.cli b/tests/lexer/test-002.cli
deleted file mode 100644
index fcd6b16..0000000
--- a/tests/lexer/test-002.cli
+++ /dev/null
@@ -1,7 +0,0 @@
-'a'
-'\n'
-'\\'
-'\0'
-'\''
-'\xaf'
-'\111'
diff --git a/tests/lexer/test-002.std b/tests/lexer/test-002.std
deleted file mode 100644
index 01daa18..0000000
--- a/tests/lexer/test-002.std
+++ /dev/null
@@ -1,8 +0,0 @@
-'a'
-'\n'
-'\\'
-'\0'
-'\''
-'\xaf'
-'\111'
-<EOS>
diff --git a/tests/lexer/test-003.cli b/tests/lexer/test-003.cli
deleted file mode 100644
index a8c2c28..0000000
--- a/tests/lexer/test-003.cli
+++ /dev/null
@@ -1,13 +0,0 @@
-"abc";
-"a\nb";
-"abc\\";
-"aaa\0";
-"\"";
-"a\xaf";
-"a\111";
-"abc""def";
-"abc" "def";
-"abc
- def
-
- xyz";
diff --git a/tests/lexer/test-003.std b/tests/lexer/test-003.std
deleted file mode 100644
index 81f2a47..0000000
--- a/tests/lexer/test-003.std
+++ /dev/null
@@ -1,24 +0,0 @@
-"abc"
-;
-"a\nb"
-;
-"abc\\"
-;
-"aaa\0"
-;
-"\""
-;
-"a\xaf"
-;
-"a\111"
-;
-"abc""def"
-;
-"abc""def"
-;
-"abc
- def
-
- xyz"
-;
-<EOS>
diff --git a/tests/lexer/test-004.cli b/tests/lexer/test-004.cli
deleted file mode 100644
index db95a81..0000000
--- a/tests/lexer/test-004.cli
+++ /dev/null
@@ -1,5 +0,0 @@
-include "foo/abc.hxx";
-include <vector>;
-include "c++:map";
-include <cli:map>;
-include "map.cli"
diff --git a/tests/lexer/test-004.std b/tests/lexer/test-004.std
deleted file mode 100644
index 4216cd1..0000000
--- a/tests/lexer/test-004.std
+++ /dev/null
@@ -1,15 +0,0 @@
-keyword: include
-c++ path: "foo/abc.hxx"
-;
-keyword: include
-c++ path: <vector>
-;
-keyword: include
-c++ path: "map"
-;
-keyword: include
-cli path: <map>
-;
-keyword: include
-cli path: "map.cli"
-<EOS>
diff --git a/tests/lexer/test-005.cli b/tests/lexer/test-005.cli
deleted file mode 100644
index 6085a33..0000000
--- a/tests/lexer/test-005.cli
+++ /dev/null
@@ -1,2 +0,0 @@
-(abc, 123 - 345, 12.34)
-<foo, bar::baz, 123*345>
diff --git a/tests/lexer/test-005.std b/tests/lexer/test-005.std
deleted file mode 100644
index 20e941b..0000000
--- a/tests/lexer/test-005.std
+++ /dev/null
@@ -1,3 +0,0 @@
-(abc, 123 - 345, 12.34)
-<foo, bar::baz, 123*345>
-<EOS>
diff --git a/tests/lexer/test-006.cli b/tests/lexer/test-006.cli
deleted file mode 100644
index d67cea7..0000000
--- a/tests/lexer/test-006.cli
+++ /dev/null
@@ -1,16 +0,0 @@
-// c++ comment ;
-/* c comment ; */
-;
-"a" // foo
-"b"
-"a" /* foo
-bar
-baz */ "b";
-- // aaa
-5;
-- /* a
-a
-a*/ 5
-// eos
-:
-::
diff --git a/tests/lexer/test-006.std b/tests/lexer/test-006.std
deleted file mode 100644
index 82709e0..0000000
--- a/tests/lexer/test-006.std
+++ /dev/null
@@ -1,9 +0,0 @@
-;
-"a""b""a""b"
-;
--5
-;
--5
-:
-::
-<EOS>
diff --git a/tests/parser/makefile b/tests/parser/makefile
deleted file mode 100644
index 490fbf3..0000000
--- a/tests/parser/makefile
+++ /dev/null
@@ -1,94 +0,0 @@
-# file : tests/parser/makefile
-# author : Boris Kolpackov <boris@codesynthesis.com>
-# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
-# license : MIT; see accompanying LICENSE file
-
-include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
-
-cxx_tun := driver.cxx
-
-tests := 000 001 002 003 004 005 006 007
-
-#
-#
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o))
-cxx_od := $(cxx_obj:.o=.o.d)
-
-driver := $(out_base)/driver
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
-# Build.
-#
-# Import.
-#
-$(call import,\
- $(scf_root)/import/libcutl/stub.make,\
- l: cutl.l,cpp-options: cutl.l.cpp-options)
-
-# Build.
-#
-cli_obj := \
-lexer.o \
-parser.o \
-semantics/class.o \
-semantics/elements.o \
-semantics/expression.o \
-semantics/namespace.o \
-semantics/option.o \
-semantics/unit.o \
-traversal/class.o \
-traversal/elements.o \
-traversal/namespace.o \
-traversal/option.o \
-traversal/unit.o
-
-$(driver): $(cxx_obj) $(addprefix $(out_root)/cli/,$(cli_obj)) $(cutl.l)
-
-$(cxx_obj) $(cxx_od): cpp_options := -I$(src_base) -I$(src_root)/cli
-$(cxx_obj) $(cxx_od): $(cutl.l.cpp-options)
-
-$(call include-dep,$(cxx_od))
-
-# Alias for default target.
-#
-$(out_base)/: $(driver)
-
-# Test.
-#
-test_targets := $(addprefix $(out_base)/.test-,$(tests))
-
-$(test): $(test_targets)
-$(test_targets): driver := $(driver)
-
-.PHONY: $(out_base)/.test-%
-$(out_base)/.test-%: $(driver) $(src_base)/test-%.cli $(src_base)/test-%.std
- $(call message,test $(out_base)/$*,$(driver) $(src_base)/test-$*.cli | diff -u $(src_base)/test-$*.std -)
-
-# Clean.
-#
-$(clean): \
- $(driver).o.clean \
- $(addsuffix .cxx.clean,$(cxx_obj)) \
- $(addsuffix .cxx.clean,$(cxx_od))
-
-# Generated .gitignore.
-#
-ifeq ($(out_base),$(src_base))
-$(driver): | $(out_base)/.gitignore
-
-$(out_base)/.gitignore: files := driver
-$(clean): $(out_base)/.gitignore.clean
-
-$(call include,$(bld_root)/git/gitignore.make)
-endif
-
-# How to.
-#
-$(call include,$(bld_root)/cxx/o-e.make)
-$(call include,$(bld_root)/cxx/cxx-o.make)
-$(call include,$(bld_root)/cxx/cxx-d.make)
-
-# Dependencies.
-#
-$(call import,$(src_root)/cli/makefile)
diff --git a/tests/parser/test-000.cli b/tests/parser/test-000.cli
deleted file mode 100644
index 04c6576..0000000
--- a/tests/parser/test-000.cli
+++ /dev/null
@@ -1,5 +0,0 @@
-// def-unit
-//
-include <string>;
-namespace n {}
-class c {};
diff --git a/tests/parser/test-000.std b/tests/parser/test-000.std
deleted file mode 100644
index e69de29..0000000
--- a/tests/parser/test-000.std
+++ /dev/null
diff --git a/tests/parser/test-001-base.cli b/tests/parser/test-001-base.cli
deleted file mode 100644
index e69de29..0000000
--- a/tests/parser/test-001-base.cli
+++ /dev/null
diff --git a/tests/parser/test-001-common.cli b/tests/parser/test-001-common.cli
deleted file mode 100644
index 73fb928..0000000
--- a/tests/parser/test-001-common.cli
+++ /dev/null
@@ -1 +0,0 @@
-include "test-001-base.cli";
diff --git a/tests/parser/test-001.cli b/tests/parser/test-001.cli
deleted file mode 100644
index 52f7f8e..0000000
--- a/tests/parser/test-001.cli
+++ /dev/null
@@ -1,6 +0,0 @@
-// include-decl-seq, include-decl
-//
-include <string>;
-include "types.hxx";
-include "test-001-common.cli";
-include "../parser/test-001-base.cli";
diff --git a/tests/parser/test-001.std b/tests/parser/test-001.std
deleted file mode 100644
index e69de29..0000000
--- a/tests/parser/test-001.std
+++ /dev/null
diff --git a/tests/parser/test-002.cli b/tests/parser/test-002.cli
deleted file mode 100644
index f8f368e..0000000
--- a/tests/parser/test-002.cli
+++ /dev/null
@@ -1,15 +0,0 @@
-// namespace-def, namespace-def-body
-//
-namespace n1 {}
-
-namespace n1
-{
- namespace n2 {}
- class c {};
- namespace n2
- {
- namespace n3 {}
- }
-}
-
-namespace n4 {}
diff --git a/tests/parser/test-002.std b/tests/parser/test-002.std
deleted file mode 100644
index e69de29..0000000
--- a/tests/parser/test-002.std
+++ /dev/null
diff --git a/tests/parser/test-003.cli b/tests/parser/test-003.cli
deleted file mode 100644
index 2920b16..0000000
--- a/tests/parser/test-003.cli
+++ /dev/null
@@ -1,23 +0,0 @@
-// class-def, inheritance-spec, abstract-spec
-//
-class c1
-{
-};
-
-class c2 = 0
-{
-};
-
-class c3: c1, ::c2
-{
-};
-
-namespace n1
-{
- class c {};
-}
-
-class c4: n1::c = 0
-{
-};
-
diff --git a/tests/parser/test-003.std b/tests/parser/test-003.std
deleted file mode 100644
index e69de29..0000000
--- a/tests/parser/test-003.std
+++ /dev/null
diff --git a/tests/parser/test-004.cli b/tests/parser/test-004.cli
deleted file mode 100644
index e913288..0000000
--- a/tests/parser/test-004.cli
+++ /dev/null
@@ -1,8 +0,0 @@
-// option-def-seq
-//
-class c
-{
- bool -a;
- int -b;
- float -c;
-};
diff --git a/tests/parser/test-004.std b/tests/parser/test-004.std
deleted file mode 100644
index e69de29..0000000
--- a/tests/parser/test-004.std
+++ /dev/null
diff --git a/tests/parser/test-005.cli b/tests/parser/test-005.cli
deleted file mode 100644
index 7798552..0000000
--- a/tests/parser/test-005.cli
+++ /dev/null
@@ -1,67 +0,0 @@
-// option-def, type-spec, fundamental-type-spec, option-name-seq,
-// option-name, initializer, initializer-expr
-//
-class c
-{
- bool --bool;
- char --char;
-
- int -i1;
- unsigned int -i2;
- int unsigned -i3;
- long -i4;
- long int -i5;
- int long -i6;
- unsigned long -i7;
- long unsigned -i8;
-
- unsigned long int -i9;
- long unsigned int -i10;
- int long unsigned -i11;
- unsigned int long -i12;
-
- short -i13;
- unsigned short -i14;
- short unsigned -i15;
-
- char -i16;
- signed char -i17;
- char signed -i18;
- unsigned char -i19;
- char unsigned -i20;
-
- long long -ll1;
- long long int -ll2;
- long long unsigned -ll3;
- int long long -ll4;
- unsigned long long -ll5;
- long long int unsigned -ll6;
- long long unsigned int -ll7;
- unsigned long long int -ll8;
- unsigned int long long -ll9;
- int long long unsigned -ll10;
- int unsigned long long -ll11;
-
- double -d1;
- long double -d2;
- double long -d3;
-
- foo -o1;
- ::foo -o2;
- ::foo<bar> -o3;
- foo::bar -o4;
- ::foo::bar -o5;
- ::foo<bar>::baz -o6;
- ::foo<bar>::baz< ::fox<2> > -o7;
-
- bool -n1|--name1|/name1;
- bool "-n2"|"--name2";
-
- string -init1 = "string";
- char -init2 = 'c';
- int -init3 = -5;
- bool -inti4 = true;
- long -init5 = (2 * 4 - 5);
- type -init6 = type::default_value;
- type -init7 (abc, 2 - 1);
-};
diff --git a/tests/parser/test-005.std b/tests/parser/test-005.std
deleted file mode 100644
index e69de29..0000000
--- a/tests/parser/test-005.std
+++ /dev/null
diff --git a/tests/parser/test-006.cli b/tests/parser/test-006.cli
deleted file mode 100644
index 5b555e4..0000000
--- a/tests/parser/test-006.cli
+++ /dev/null
@@ -1,16 +0,0 @@
-// option-doc
-//
-class c
-{
- bool --help | -h {"Help me"};
-
- int --comp = 5
- {
- "<level>",
- "Set compression level",
- "Set compression level to <level>.
-
- The minimum value for this options is 0 and
- maximum is 9."
- };
-};
diff --git a/tests/parser/test-006.std b/tests/parser/test-006.std
deleted file mode 100644
index e69de29..0000000
--- a/tests/parser/test-006.std
+++ /dev/null
diff --git a/tests/parser/test-007-base.cli b/tests/parser/test-007-base.cli
deleted file mode 100644
index 7c02a39..0000000
--- a/tests/parser/test-007-base.cli
+++ /dev/null
@@ -1,11 +0,0 @@
-class b1 {};
-
-namespace n1
-{
- class b2 {};
-
- namespace i1
- {
- class b3 {};
- }
-}
diff --git a/tests/parser/test-007.cli b/tests/parser/test-007.cli
deleted file mode 100644
index b890a34..0000000
--- a/tests/parser/test-007.cli
+++ /dev/null
@@ -1,30 +0,0 @@
-// base class lookup
-//
-
-include "test-007-base.cli";
-
-class c1 {};
-class c2: c1 {};
-class c3: ::c1 {};
-
-namespace n1
-{
- class c4 {};
- class c5: c4 {};
- class c6: n1::c4 {};
- class c7: ::n1::c4 {};
-
- class c8: b2 {}; // From included.
- class c9: i1::b3 {}; // From included.
-
- namespace i1
- {
- class c10: c4 {}; // Outer scope.
- class c11: b3 {}; // From included.
- class c12: b2 {}; // Outer scope from included.
- class c4: n1::c4 {}; // Qualified name from outer scope.
- }
-}
-
-class c13: n1::c4 {};
-class c14: ::n1::c4 {};
diff --git a/tests/parser/test-007.std b/tests/parser/test-007.std
deleted file mode 100644
index e69de29..0000000
--- a/tests/parser/test-007.std
+++ /dev/null
diff --git a/tests/specifier/buildfile b/tests/specifier/buildfile
new file mode 100644
index 0000000..3d11b0d
--- /dev/null
+++ b/tests/specifier/buildfile
@@ -0,0 +1,14 @@
+# file : tests/specifier/buildfile
+# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+# license : MIT; see accompanying LICENSE file
+
+exe{driver}: cxx{driver} {hxx ixx cxx}{test}
+exe{driver}: test.arguments = -a -c foo
+
+cxx.poptions =+ -I$out_base
+
+# Generated options parser.
+#
+{hxx ixx cxx}{test}: cli{test}
+
+cli.options = --generate-specifier --generate-modifier
diff --git a/tests/specifier/makefile b/tests/specifier/makefile
deleted file mode 100644
index eed02fb..0000000
--- a/tests/specifier/makefile
+++ /dev/null
@@ -1,73 +0,0 @@
-# file : tests/specifier/makefile
-# author : Boris Kolpackov <boris@codesynthesis.com>
-# copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
-# license : MIT; see accompanying LICENSE file
-
-include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make
-
-cxx_tun := driver.cxx
-cli_tun := test.cli
-
-#
-#
-cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o) $(cli_tun:.cli=.o))
-cxx_od := $(cxx_obj:.o=.o.d)
-
-driver := $(out_base)/driver
-test := $(out_base)/.test
-clean := $(out_base)/.clean
-
-# Build.
-#
-$(driver): $(cxx_obj)
-$(cxx_obj) $(cxx_od): cpp_options := -I$(out_base)
-
-genf := $(cli_tun:.cli=.hxx) $(cli_tun:.cli=.ixx) $(cli_tun:.cli=.cxx)
-gen := $(addprefix $(out_base)/,$(genf))
-
-$(gen): $(out_root)/cli/cli
-$(gen): cli := $(out_root)/cli/cli
-$(gen): cli_options := --generate-specifier --generate-modifier
-
-$(call include-dep,$(cxx_od),$(cxx_obj),$(gen))
-
-# Alias for default target.
-#
-$(out_base)/: $(driver)
-
-# Test.
-#
-$(test): driver := $(driver)
-$(test): $(driver)
- $(call message,test $$1,$$1 -a -c foo,$(driver))
-
-# Clean.
-#
-$(clean): \
- $(driver).o.clean \
- $(addsuffix .cxx.clean,$(cxx_obj)) \
- $(addsuffix .cxx.clean,$(cxx_od)) \
- $(addprefix $(out_base)/,$(cli_tun:.cli=.cxx.cli.clean))
-
-# Generated .gitignore.
-#
-ifeq ($(out_base),$(src_base))
-$(driver): | $(out_base)/.gitignore
-
-$(out_base)/.gitignore: files := driver $(genf)
-$(clean): $(out_base)/.gitignore.clean
-
-$(call include,$(bld_root)/git/gitignore.make)
-endif
-
-# How to.
-#
-$(call include,$(bld_root)/cxx/o-e.make)
-$(call include,$(bld_root)/cxx/cxx-o.make)
-$(call include,$(bld_root)/cxx/cxx-d.make)
-$(call include,$(scf_root)/cli/cli-cxx.make)
-
-# Dependencies.
-#
-$(call import,$(src_root)/cli/makefile)
-
diff --git a/tests/toc/buildfile b/tests/toc/buildfile
new file mode 100644
index 0000000..36e12c9
--- /dev/null
+++ b/tests/toc/buildfile
@@ -0,0 +1,5 @@
+# file : tests/toc/buildfile
+# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+# license : MIT; see accompanying LICENSE file
+
+./: test{testscript}
diff --git a/tests/toc/toc.html b/tests/toc/testscript
index 5305db9..76a28eb 100644
--- a/tests/toc/toc.html
+++ b/tests/toc/testscript
@@ -1,11 +1,80 @@
+# file : tests/toc/testscript
+# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+# 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 colspan="2"><a href="#preface">Preface</a>
+ <tr><td class="preface" colspan="2"><a href="#preface">Preface</a>
<table class="toc">
- <tr><td colspan="2"><a href="#about-document">About This
-Document</a></td></tr>
- <tr><td colspan="2"><a href="#more-information">More Information</a></td></tr>
+ <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>
@@ -86,3 +155,4 @@ with Clang</a></td></tr>
<p>Some remarks.</p>
+EOO
diff --git a/tests/toc/toc.cli b/tests/toc/toc.cli
deleted file mode 100644
index cb6fd8c..0000000
--- a/tests/toc/toc.cli
+++ /dev/null
@@ -1,57 +0,0 @@
-"\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.
-"
diff --git a/unit-tests/.gitignore b/unit-tests/.gitignore
new file mode 100644
index 0000000..e54525b
--- /dev/null
+++ b/unit-tests/.gitignore
@@ -0,0 +1 @@
+driver
diff --git a/unit-tests/buildfile b/unit-tests/buildfile
new file mode 100644
index 0000000..6e25aae
--- /dev/null
+++ b/unit-tests/buildfile
@@ -0,0 +1,7 @@
+# file : unit-tests/buildfile
+# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+# license : MIT; see accompanying LICENSE file
+
+d = lexer/ parser/
+./: $d
+include $d
diff --git a/unit-tests/lexer/buildfile b/unit-tests/lexer/buildfile
new file mode 100644
index 0000000..483250e
--- /dev/null
+++ b/unit-tests/lexer/buildfile
@@ -0,0 +1,12 @@
+# file : unit-tests/lexer/buildfile
+# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+# license : MIT; see accompanying LICENSE file
+
+#@@ Temporary until we get utility library support.
+#
+import libs = libcutl%lib{cutl}
+src = lexer
+
+exe{driver}: cxx{driver} ../../cli/cxx{$src} $libs test{testscript}
+
+include ../../cli/
diff --git a/tests/lexer/driver.cxx b/unit-tests/lexer/driver.cxx
index a054aad..471bc1b 100644
--- a/tests/lexer/driver.cxx
+++ b/unit-tests/lexer/driver.cxx
@@ -1,4 +1,4 @@
-// file : tests/lexer/driver.cxx
+// file : unit-tests/lexer/driver.cxx
// author : Boris Kolpackov <boris@codesynthesis.com>
// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
// license : MIT; see accompanying LICENSE file
@@ -6,8 +6,8 @@
#include <fstream>
#include <iostream>
-#include <token.hxx>
-#include <lexer.hxx>
+#include <cli/token.hxx>
+#include <cli/lexer.hxx>
using namespace std;
diff --git a/unit-tests/lexer/testscript b/unit-tests/lexer/testscript
new file mode 100644
index 0000000..fb4f862
--- /dev/null
+++ b/unit-tests/lexer/testscript
@@ -0,0 +1,192 @@
+# file : unit-tests/lexer/testscript
+# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+# license : MIT; see accompanying LICENSE file
+
+# @@ Give tests some meaningfull descriptions.
+#
+
+: 000
+:
+cat <<EOI >>>test.cli;
+help
+help-me
+-h
+--help
+--help-me
+--help-me-
+/h
+/help-me
+/help/me
+--_
+
+EOI
+$* test.cli >>EOO
+identifier: help
+identifier: help-me
+identifier: -h
+identifier: --help
+identifier: --help-me
+identifier: --help-me-
+identifier: /h
+identifier: /help-me
+identifier: /help
+identifier: /me
+identifier: --_
+<EOS>
+EOO
+
+: 001
+:
+cat <<EOI >>>test.cli;
+5
+123456
+-12345
+- 1
+-
+123
+EOI
+$* test.cli >>EOO
+5
+123456
+-12345
+-1
+-123
+<EOS>
+EOO
+
+: 002
+:
+cat <<EOI >>>test.cli;
+'a'
+'\\n'
+'\\\\'
+'\\0'
+'\\''
+'\\xaf'
+'\\111'
+EOI
+$* test.cli >>EOO
+'a'
+'\\n'
+'\\\\'
+'\\0'
+'\\''
+'\\xaf'
+'\\111'
+<EOS>
+EOO
+
+: 003
+:
+cat <<EOI >>>test.cli;
+"abc";
+"a\\nb";
+"abc\\\\";
+"aaa\\0";
+"\\"";
+"a\\xaf";
+"a\\111";
+"abc""def";
+"abc" "def";
+"abc
+ def
+
+ xyz";
+EOI
+$* test.cli >>EOO
+"abc"
+;
+"a\\nb"
+;
+"abc\\\\"
+;
+"aaa\\0"
+;
+"\\""
+;
+"a\\xaf"
+;
+"a\\111"
+;
+"abc""def"
+;
+"abc""def"
+;
+"abc
+ def
+
+ xyz"
+;
+<EOS>
+EOO
+
+: 004
+:
+cat <<EOI >>>test.cli;
+include "foo/abc.hxx";
+include <vector>;
+include "c++:map";
+include <cli:map>;
+include "map.cli"
+EOI
+$* test.cli >>EOO
+keyword: include
+c++ path: "foo/abc.hxx"
+;
+keyword: include
+c++ path: <vector>
+;
+keyword: include
+c++ path: "map"
+;
+keyword: include
+cli path: <map>
+;
+keyword: include
+cli path: "map.cli"
+<EOS>
+EOO
+
+: 005
+:
+cat <<EOI >>>test.cli;
+\(abc, 123 - 345, 12.34)
+<foo, bar::baz, 123*345>
+EOI
+$* test.cli >>EOO
+\(abc, 123 - 345, 12.34)
+<foo, bar::baz, 123*345>
+<EOS>
+EOO
+
+: 006
+:
+cat <<EOI >>>test.cli;
+// c++ comment ;
+/* c comment ; */
+;
+"a" // foo
+"b"
+"a" /* foo
+bar
+baz */ "b";
+- // aaa
+5;
+- /* a
+a
+a*/ 5
+// eos
+:
+::
+EOI
+$* test.cli >>EOO
+;
+"a""b""a""b"
+;
+-5
+;
+-5
+:
+::
+<EOS>
+EOO
diff --git a/unit-tests/parser/buildfile b/unit-tests/parser/buildfile
new file mode 100644
index 0000000..c7a2b59
--- /dev/null
+++ b/unit-tests/parser/buildfile
@@ -0,0 +1,14 @@
+# file : unit-tests/parser/buildfile
+# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+# license : MIT; see accompanying LICENSE file
+
+#@@ Temporary until we get utility library support.
+#
+import libs = libcutl%lib{cutl}
+src = lexer parser \
+semantics/{class elements expression namespace option unit} \
+traversal/{class elements namespace option unit}
+
+exe{driver}: cxx{driver} ../../cli/cxx{$src} $libs test{testscript}
+
+include ../../cli/
diff --git a/tests/parser/driver.cxx b/unit-tests/parser/driver.cxx
index bc963b5..b2dc9d5 100644
--- a/tests/parser/driver.cxx
+++ b/unit-tests/parser/driver.cxx
@@ -1,4 +1,4 @@
-// file : tests/parser/driver.cxx
+// file : unit-tests/parser/driver.cxx
// author : Boris Kolpackov <boris@codesynthesis.com>
// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
// license : MIT; see accompanying LICENSE file
@@ -6,9 +6,9 @@
#include <fstream>
#include <iostream>
-#include <parser.hxx>
-#include <semantics.hxx>
-#include <traversal.hxx>
+#include <cli/parser.hxx>
+#include <cli/semantics.hxx>
+#include <cli/traversal.hxx>
using namespace std;
diff --git a/unit-tests/parser/testscript b/unit-tests/parser/testscript
new file mode 100644
index 0000000..0ae0378
--- /dev/null
+++ b/unit-tests/parser/testscript
@@ -0,0 +1,243 @@
+# file : unit-tests/parser/testscript
+# copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
+# license : MIT; see accompanying LICENSE file
+
+# @@ Give tests some meaningfull descriptions. Probably move c++-style comments
+# from the test.cli files to test descriptions.
+#
+
+: 000
+:
+cat <<EOI >>>test.cli;
+// def-unit
+//
+include <string>;
+namespace n {}
+class c {};
+EOI
+$* test.cli >:""
+
+: 001
+:
+cat <<EOI >>>base.cli;
+EOI
+cat <<EOI >>>common.cli;
+include "base.cli";
+EOI
+cat <<EOI >>>test.cli;
+// include-decl-seq, include-decl
+//
+include <string>;
+include "types.hxx";
+include "common.cli";
+include "../001/base.cli";
+EOI
+$* test.cli >:""
+
+: 002
+:
+cat <<EOI >>>test.cli;
+// namespace-def, namespace-def-body
+//
+namespace n1 {}
+
+namespace n1
+{
+ namespace n2 {}
+ class c {};
+ namespace n2
+ {
+ namespace n3 {}
+ }
+}
+
+namespace n4 {}
+EOI
+$* test.cli >:""
+
+: 003
+:
+cat <<EOI >>>test.cli;
+// class-def, inheritance-spec, abstract-spec
+//
+class c1
+{
+};
+
+class c2 = 0
+{
+};
+
+class c3: c1, ::c2
+{
+};
+
+namespace n1
+{
+ class c {};
+}
+
+class c4: n1::c = 0
+{
+};
+
+EOI
+$* test.cli >:""
+
+: 004
+:
+cat <<EOI >>>test.cli;
+// option-def-seq
+//
+class c
+{
+ bool -a;
+ int -b;
+ float -c;
+};
+EOI
+$* test.cli >:""
+
+: 005
+:
+cat <<EOI >>>test.cli;
+// option-def, type-spec, fundamental-type-spec, option-name-seq,
+// option-name, initializer, initializer-expr
+//
+class c
+{
+ bool --bool;
+ char --char;
+
+ int -i1;
+ unsigned int -i2;
+ int unsigned -i3;
+ long -i4;
+ long int -i5;
+ int long -i6;
+ unsigned long -i7;
+ long unsigned -i8;
+
+ unsigned long int -i9;
+ long unsigned int -i10;
+ int long unsigned -i11;
+ unsigned int long -i12;
+
+ short -i13;
+ unsigned short -i14;
+ short unsigned -i15;
+
+ char -i16;
+ signed char -i17;
+ char signed -i18;
+ unsigned char -i19;
+ char unsigned -i20;
+
+ long long -ll1;
+ long long int -ll2;
+ long long unsigned -ll3;
+ int long long -ll4;
+ unsigned long long -ll5;
+ long long int unsigned -ll6;
+ long long unsigned int -ll7;
+ unsigned long long int -ll8;
+ unsigned int long long -ll9;
+ int long long unsigned -ll10;
+ int unsigned long long -ll11;
+
+ double -d1;
+ long double -d2;
+ double long -d3;
+
+ foo -o1;
+ ::foo -o2;
+ ::foo<bar> -o3;
+ foo::bar -o4;
+ ::foo::bar -o5;
+ ::foo<bar>::baz -o6;
+ ::foo<bar>::baz< ::fox<2> > -o7;
+
+ bool -n1|--name1|/name1;
+ bool "-n2"|"--name2";
+
+ string -init1 = "string";
+ char -init2 = 'c';
+ int -init3 = -5;
+ bool -inti4 = true;
+ long -init5 = \(2 * 4 - 5);
+ type -init6 = type::default_value;
+ type -init7 \(abc, 2 - 1);
+};
+EOI
+$* test.cli >:""
+
+: 006
+:
+cat <<EOI >>>test.cli;
+// option-doc
+//
+class c
+{
+ bool --help | -h {"Help me"};
+
+ int --comp = 5
+ {
+ "<level>",
+ "Set compression level",
+ "Set compression level to <level>.
+
+ The minimum value for this options is 0 and
+ maximum is 9."
+ };
+};
+EOI
+$* test.cli >:""
+
+: 007
+:
+cat <<EOI >>>base.cli;
+class b1 {};
+
+namespace n1
+{
+ class b2 {};
+
+ namespace i1
+ {
+ class b3 {};
+ }
+}
+EOI
+cat <<EOI >>>test.cli;
+// base class lookup
+//
+
+include "base.cli";
+
+class c1 {};
+class c2: c1 {};
+class c3: ::c1 {};
+
+namespace n1
+{
+ class c4 {};
+ class c5: c4 {};
+ class c6: n1::c4 {};
+ class c7: ::n1::c4 {};
+
+ class c8: b2 {}; // From included.
+ class c9: i1::b3 {}; // From included.
+
+ namespace i1
+ {
+ class c10: c4 {}; // Outer scope.
+ class c11: b3 {}; // From included.
+ class c12: b2 {}; // Outer scope from included.
+ class c4: n1::c4 {}; // Qualified name from outer scope.
+ }
+}
+
+class c13: n1::c4 {};
+class c14: ::n1::c4 {};
+EOI
+$* test.cli >:""