From 949a9f572341b6cd07690f0b78b1b1941d320055 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 15 Dec 2020 22:23:46 +0300 Subject: Switch to build2 --- tests/.gitignore | 3 + tests/build/.gitignore | 3 + tests/build/bootstrap.build | 8 + tests/build/root.build | 23 + tests/buildfile | 4 + tests/dump/driver.cxx | 724 ------------------------------ tests/dump/makefile | 54 --- tests/makefile | 15 - tests/schema/annotation.testscript | 298 ++++++++++++ tests/schema/annotation/makefile | 33 -- tests/schema/annotation/test-000.std | 67 --- tests/schema/annotation/test-000.xsd | 120 ----- tests/schema/annotation/test-001.std | 36 -- tests/schema/annotation/test-001.xsd | 53 --- tests/schema/anonymous.testscript | 181 ++++++++ tests/schema/anonymous/makefile | 33 -- tests/schema/anonymous/test-000.std | 30 -- tests/schema/anonymous/test-000.xsd | 42 -- tests/schema/anonymous/test-001.std | 38 -- tests/schema/anonymous/test-001.xsd | 47 -- tests/schema/attribute-group.testscript | 102 +++++ tests/schema/attribute-group/makefile | 33 -- tests/schema/attribute-group/test-000.std | 17 - tests/schema/attribute-group/test-000.xsd | 31 -- tests/schema/attribute-group/test-001.std | 12 - tests/schema/attribute-group/test-001.xsd | 20 - tests/schema/buildfile | 6 + tests/schema/default.testscript | 99 ++++ tests/schema/default/makefile | 33 -- tests/schema/default/test-000.std | 28 -- tests/schema/default/test-000.xsd | 23 - tests/schema/default/test-001.std | 15 - tests/schema/default/test-001.xsd | 11 - tests/schema/driver.cxx | 724 ++++++++++++++++++++++++++++++ tests/schema/element-group.testscript | 324 +++++++++++++ tests/schema/element-group/makefile | 33 -- tests/schema/element-group/test-000.std | 33 -- tests/schema/element-group/test-000.xsd | 39 -- tests/schema/element-group/test-001.std | 137 ------ tests/schema/element-group/test-001.xsd | 33 -- tests/schema/element-group/test-002.std | 24 - tests/schema/element-group/test-002.xsd | 26 -- tests/schema/enumeration.testscript | 148 ++++++ tests/schema/enumeration/makefile | 33 -- tests/schema/enumeration/test-000.std | 62 --- tests/schema/enumeration/test-000.xsd | 72 --- tests/schema/makefile | 23 - tests/schema/union.testscript | 135 ++++++ tests/schema/union/makefile | 33 -- tests/schema/union/test-000.std | 37 -- tests/schema/union/test-000.xsd | 40 -- tests/schema/union/test-001.std | 15 - tests/schema/union/test-001.xsd | 21 - 53 files changed, 2058 insertions(+), 2176 deletions(-) create mode 100644 tests/.gitignore create mode 100644 tests/build/.gitignore create mode 100644 tests/build/bootstrap.build create mode 100644 tests/build/root.build create mode 100644 tests/buildfile delete mode 100644 tests/dump/driver.cxx delete mode 100644 tests/dump/makefile delete mode 100644 tests/makefile create mode 100644 tests/schema/annotation.testscript delete mode 100644 tests/schema/annotation/makefile delete mode 100644 tests/schema/annotation/test-000.std delete mode 100644 tests/schema/annotation/test-000.xsd delete mode 100644 tests/schema/annotation/test-001.std delete mode 100644 tests/schema/annotation/test-001.xsd create mode 100644 tests/schema/anonymous.testscript delete mode 100644 tests/schema/anonymous/makefile delete mode 100644 tests/schema/anonymous/test-000.std delete mode 100644 tests/schema/anonymous/test-000.xsd delete mode 100644 tests/schema/anonymous/test-001.std delete mode 100644 tests/schema/anonymous/test-001.xsd create mode 100644 tests/schema/attribute-group.testscript delete mode 100644 tests/schema/attribute-group/makefile delete mode 100644 tests/schema/attribute-group/test-000.std delete mode 100644 tests/schema/attribute-group/test-000.xsd delete mode 100644 tests/schema/attribute-group/test-001.std delete mode 100644 tests/schema/attribute-group/test-001.xsd create mode 100644 tests/schema/buildfile create mode 100644 tests/schema/default.testscript delete mode 100644 tests/schema/default/makefile delete mode 100644 tests/schema/default/test-000.std delete mode 100644 tests/schema/default/test-000.xsd delete mode 100644 tests/schema/default/test-001.std delete mode 100644 tests/schema/default/test-001.xsd create mode 100644 tests/schema/driver.cxx create mode 100644 tests/schema/element-group.testscript delete mode 100644 tests/schema/element-group/makefile delete mode 100644 tests/schema/element-group/test-000.std delete mode 100644 tests/schema/element-group/test-000.xsd delete mode 100644 tests/schema/element-group/test-001.std delete mode 100644 tests/schema/element-group/test-001.xsd delete mode 100644 tests/schema/element-group/test-002.std delete mode 100644 tests/schema/element-group/test-002.xsd create mode 100644 tests/schema/enumeration.testscript delete mode 100644 tests/schema/enumeration/makefile delete mode 100644 tests/schema/enumeration/test-000.std delete mode 100644 tests/schema/enumeration/test-000.xsd delete mode 100644 tests/schema/makefile create mode 100644 tests/schema/union.testscript delete mode 100644 tests/schema/union/makefile delete mode 100644 tests/schema/union/test-000.std delete mode 100644 tests/schema/union/test-000.xsd delete mode 100644 tests/schema/union/test-001.std delete mode 100644 tests/schema/union/test-001.xsd (limited to 'tests') diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 0000000..2e508a9 --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1,3 @@ +driver +test/ +test-*/ diff --git a/tests/build/.gitignore b/tests/build/.gitignore new file mode 100644 index 0000000..4a730a3 --- /dev/null +++ b/tests/build/.gitignore @@ -0,0 +1,3 @@ +config.build +root/ +bootstrap/ diff --git a/tests/build/bootstrap.build b/tests/build/bootstrap.build new file mode 100644 index 0000000..33c8d02 --- /dev/null +++ b/tests/build/bootstrap.build @@ -0,0 +1,8 @@ +# file : tests/build/bootstrap.build +# license : GNU GPL v2 + exceptions; 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..c062795 --- /dev/null +++ b/tests/build/root.build @@ -0,0 +1,23 @@ +# file : tests/build/root.build +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +cxx.std = latest + +using cxx + +hxx{*}: extension = hxx +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 + +# 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 new file mode 100644 index 0000000..97a1f9c --- /dev/null +++ b/tests/buildfile @@ -0,0 +1,4 @@ +# file : tests/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +./: {*/ -build/} diff --git a/tests/dump/driver.cxx b/tests/dump/driver.cxx deleted file mode 100644 index dc87d59..0000000 --- a/tests/dump/driver.cxx +++ /dev/null @@ -1,724 +0,0 @@ -// file : tests/dump/driver.cxx -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#include -#include -#include -#include - -#include -#include - -#include - -using namespace std; -using namespace XSDFrontend; - -static unsigned long indent; - -std::wostream& -ind (std::wostream& os) -{ - for (unsigned long n (0); n < indent; ++n) - os << L" "; - - return os; -} - -namespace -{ - // Nameable which is named in the namespace scope. - // - String - ref_name (SemanticGraph::Nameable& n) - { - String const& scope (n.scope ().name ()); - - return scope + (scope.empty () ? L"" : L"#") + n.name (); - } - - struct List: Traversal::List - { - virtual void - traverse (Type& l) - { - if (l.annotated_p ()) - wcout << ind << "<" << l.annotation ().documentation () << ">" - << endl; - - wcout << ind << "list " << - (l.named_p () ? l.name () : String ("")); - - SemanticGraph::Type& t (l.argumented ().type ()); - - if (t.named_p ()) - wcout << " " << ref_name (t) << endl; - else - { - wcout << endl - << ind << "{" << endl; - indent++; - - edge_traverser ().dispatch (l.argumented ()); - - indent--; - wcout << ind << "}" << endl; - } - } - }; - - struct Union: Traversal::Union - { - virtual void - traverse (Type& u) - { - if (u.annotated_p ()) - wcout << ind << "<" << u.annotation ().documentation () << ">" - << endl; - - wcout << ind << "union " << - (u.named_p () ? u.name () : String ("")) << " "; - - for (Type::ArgumentedIterator i (u.argumented_begin ()); - i != u.argumented_end (); ++i) - { - SemanticGraph::Type& t (i->type ()); - - if (t.named_p ()) - wcout << ref_name (t) << " "; - else - { - wcout << endl - << ind << "{" << endl; - indent++; - - edge_traverser ().dispatch (*i); - - indent--; - wcout << ind << "}" << endl; - } - } - - wcout << endl; - } - }; - - struct Enumerator: Traversal::Enumerator - { - virtual void - traverse (Type& e) - { - if (e.annotated_p ()) - wcout << ind << "<" << e.annotation ().documentation () << ">" - << endl; - - wcout << ind << "enumerator " << e.name () << endl; - } - }; - - struct Enumeration: Traversal::Enumeration - { - virtual void - traverse (Type& e) - { - if (e.annotated_p ()) - wcout << ind << "<" << e.annotation ().documentation () << ">" - << endl; - - wcout << ind << "enumeration " << - (e.named_p () ? e.name () : String ("")) << ": " << - ref_name (e.inherits ().base ()) << endl - << ind << "{" << endl; - - indent++; - Traversal::Enumeration::traverse (e); - indent--; - - wcout << ind << "}" << endl; - } - }; - - struct ContainsParticle: Traversal::ContainsParticle - { - virtual void - traverse (Type& cp) - { - wcout << ind << "[" << cp.min () << ", "; - - if (cp.max () == 0) - wcout << "unbounded] "; - else - wcout << cp.max () << "] "; - - Traversal::ContainsParticle::traverse (cp); - } - }; - - struct ContainsCompositor: Traversal::ContainsCompositor - { - virtual void - traverse (Type& cc) - { - wcout << ind << "[" << cc.min () << ", "; - - if (cc.max () == 0) - wcout << "unbounded] "; - else - wcout << cc.max () << "] "; - - Traversal::ContainsCompositor::traverse (cc); - } - }; - - struct Compositor: Traversal::All, - Traversal::Choice, - Traversal::Sequence - { - virtual void - traverse (SemanticGraph::All& a) - { - wcout << "all" << endl - << ind << "{" << endl; - - indent++; - - Traversal::All::traverse (a); - - indent--; - - wcout << ind << "}" << endl; - } - - virtual void - traverse (SemanticGraph::Choice& c) - { - wcout << "choice" << endl - << ind << "{" << endl; - - indent++; - - Traversal::Choice::traverse (c); - - indent--; - - wcout << ind << "}" << endl; - } - - virtual void - traverse (SemanticGraph::Sequence& s) - { - wcout << "sequence" << endl - << ind << "{" << endl; - - indent++; - - Traversal::Sequence::traverse (s); - - indent--; - - wcout << ind << "}" << endl; - } - }; - - struct Attribute: Traversal::Attribute - { - virtual void - traverse (Type& a) - { - if (a.annotated_p ()) - wcout << ind << "<" << a.annotation ().documentation () << ">" - << endl; - - wcout << ind << (a.optional_p () ? "optional" : "required") - << " attribute " << a.name (); - - if (a.fixed_p ()) - wcout << "==" << a.value (); - else if (a.default_p ()) - wcout << "=" << a.value (); - - SemanticGraph::Type& t (a.type ()); - - if (t.named_p ()) - wcout << " " << ref_name (t) << endl; - else - { - wcout << endl - << ind << "{" << endl; - indent++; - - belongs (a); - - indent--; - wcout << ind << "}" << endl; - } - } - }; - - struct AnyAttribute: Traversal::AnyAttribute - { - virtual void - traverse (Type& a) - { - if (a.annotated_p ()) - wcout << ind << "<" << a.annotation ().documentation () << ">" - << endl; - - wcout << ind << "any-attribute '" << a.name () << "'" << endl; - } - }; - - struct Element: Traversal::Element - { - virtual void - traverse (Type& e) - { - wcout << "element " << e.name (); - - if (e.fixed_p ()) - wcout << "==" << e.value (); - else if (e.default_p ()) - wcout << "=" << e.value (); - - SemanticGraph::Type& t (e.type ()); - - if (t.named_p ()) - wcout << " " << ref_name (t) << endl; - else - { - wcout << endl - << ind << "{" << endl; - indent++; - - belongs (e); - - indent--; - wcout << ind << "}" << endl; - } - } - }; - - struct ElementFlat: Traversal::Element - { - virtual void - traverse (Type& e) - { - if (e.annotated_p ()) - wcout << ind << "<" << e.annotation ().documentation () << ">" - << endl; - - wcout << ind << "element " << e.name (); - - if (e.fixed_p ()) - wcout << "==" << e.value (); - else if (e.default_p ()) - wcout << "=" << e.value (); - - wcout << endl; - } - }; - - struct Any: Traversal::Any - { - virtual void - traverse (Type& a) - { - wcout << "any '" << a.name () << "'" << endl; - } - }; - - struct AnyFlat: Traversal::Any - { - virtual void - traverse (Type& a) - { - if (a.annotated_p ()) - wcout << ind << "<" << a.annotation ().documentation () << ">" - << endl; - - wcout << ind << "any '" << a.name () << "'" << endl; - } - }; - - struct Complex: Traversal::Complex - { - virtual void - traverse (Type& c) - { - // Anonymous type definition can recursively refer to itself. - // - if (c.context ().count ("seen")) - { - wcout << ind << "complex " << endl; - return; - } - - c.context ().set ("seen", true); - - if (c.annotated_p ()) - wcout << ind << "<" << c.annotation ().documentation () << ">" - << endl; - - wcout << ind << "complex " << - (c.named_p () ? c.name () : String ("")); - - if (c.inherits_p ()) - wcout << ": " << ref_name (c.inherits ().base ()); - - wcout << endl - << ind << "{" << endl; - indent++; - - Traversal::Complex::traverse (c); - - indent--; - wcout << ind << "}" << endl; - - c.context ().remove ("seen"); - } - }; - - struct GlobalAttribute: Traversal::Attribute - { - virtual void - traverse (Type& a) - { - if (a.annotated_p ()) - wcout << ind << "<" << a.annotation ().documentation () << ">" - << endl; - - wcout << ind << "attribute " << a.name (); - - if (a.fixed_p ()) - wcout << "==" << a.value (); - else if (a.default_p ()) - wcout << "=" << a.value (); - - SemanticGraph::Type& t (a.type ()); - - if (t.named_p ()) - wcout << " " << ref_name (t) << endl; - else - { - wcout << endl - << ind << "{" << endl; - indent++; - - belongs (a); - - indent--; - wcout << ind << "}" << endl; - } - } - }; - - struct GlobalElement: Traversal::Element - { - virtual void - traverse (Type& e) - { - if (e.annotated_p ()) - wcout << ind << "<" << e.annotation ().documentation () << ">" - << endl; - - wcout << ind << "element " << e.name (); - - if (e.fixed_p ()) - wcout << "==" << e.value (); - else if (e.default_p ()) - wcout << "=" << e.value (); - - SemanticGraph::Type& t (e.type ()); - - if (t.named_p ()) - wcout << " " << ref_name (t) << endl; - else - { - wcout << endl - << ind << "{" << endl; - indent++; - - belongs (e); - - indent--; - wcout << ind << "}" << endl; - } - } - }; - - struct Namespace: Traversal::Namespace - { - virtual void - traverse (Type& n) - { - wcout << ind << "namespace " << n.name () << endl - << ind << "{" << endl; - indent++; - Traversal::Namespace::traverse (n); - indent--; - wcout << ind << "}" << endl; - } - }; - - // Go into implied/included/imported schemas while making sure - // we don't recurse forever. - // - struct Uses: Traversal::Imports, - Traversal::Includes, - Traversal::Sources - //Traversal::Implies @@ Need a --with-implies option - { - virtual void - traverse (SemanticGraph::Imports& i) - { - if (traverse_uses (i, "imports")) - Traversal::Imports::traverse (i); - } - - virtual void - traverse (SemanticGraph::Includes& i) - { - if (traverse_uses (i, "includes")) - Traversal::Includes::traverse (i); - } - - virtual void - traverse (SemanticGraph::Sources& s) - { - if (traverse_uses (s, "sources")) - Traversal::Sources::traverse (s); - } - - /* - virtual void - traverse (SemanticGraph::Implies& i) - { - if (traverse_uses (i, "implies")) - Traversal::Implies::traverse (i); - } - */ - - bool - traverse_uses (SemanticGraph::Uses& u, String const& type) - { - SemanticGraph::Schema& s (u.schema ()); - - if (s.context ().count ("seen")) - { - wcout << ind << "recursively " << type << " " << u.path () << endl; - return false; - } - - s.context ().set ("seen", true); - - if (s.annotated_p ()) - wcout << ind << "<" << s.annotation ().documentation () << ">" << endl; - - wcout << ind << type << " " << u.path () << endl; - - return true; - } - }; - - struct Schema: Traversal::Schema - { - virtual void - traverse (Type& s) - { - wcout << ind << "{" << endl; - indent++; - Traversal::Schema::traverse (s); - indent--; - wcout << ind << "}" << endl; - } - }; -} - -struct AnonymousNameTranslator: Transformations::AnonymousNameTranslator -{ - virtual String - translate (String const& /*file*/, - String const& ns, - String const& name, - String const& xpath) - { - wcout << "anonymous: " << ns << " " << name << " " << xpath << endl; - return name; - } -}; - -int -main (int argc, char* argv[]) -{ - try - { - if (argc < 2) - { - wcerr << argv[0] << ": error: no input file." << endl; - return 1; - } - - // Parse options. - // - int i (1); - bool anon (false); - bool enum_synth (false); - - for (; i < argc; ++i) - { - if (argv[i] == NarrowString ("--anonymous")) - anon = true; - else if (argv[i] == NarrowString ("--enum-synthesis")) - enum_synth = true; - else - break; - } - - // Parse schema. - // - SemanticGraph::Path path (argv[i]); - - Parser parser (true, false, true); - auto_ptr tu (parser.parse (path)); - - // - // - if (anon) - { - try - { - AnonymousNameTranslator transl; - Transformations::Anonymous transf (transl); - transf.transform (*tu, path, true); - } - catch (Transformations::Anonymous::Failed const&) - { - // Diagnostics has already been issued. - // - return 1; - } - } - - // - // - if (enum_synth) - { - Transformations::EnumSynthesis transf; - transf.transform (*tu, path); - } - - // - // - Schema schema; - Uses uses; - - schema >> uses >> schema; - - Traversal::Names schema_names; - Namespace ns; - Traversal::Names ns_names; - - schema >> schema_names >> ns >> ns_names; - - // - // - List list; - Union union_; - Complex complex; - Enumeration enumeration; - GlobalElement global_element; - GlobalAttribute global_attribute; - - Traversal::Names complex_names; - Traversal::Names enumeration_names; - ContainsCompositor contains_compositor; - - ns_names >> list; - ns_names >> union_; - ns_names >> complex; - ns_names >> enumeration; - ns_names >> global_attribute; - ns_names >> global_element; - - complex >> complex_names; - complex >> contains_compositor; - - enumeration >> enumeration_names; - - // - // - Compositor compositor; - ContainsParticle contains_particle; - - contains_compositor >> compositor; - compositor >> contains_particle >> compositor; - - // - // - Any any; - AnyFlat any_flat; - Element element; - ElementFlat element_flat; - Attribute attribute; - AnyAttribute any_attribute; - Traversal::Belongs belongs; - - element >> belongs; - attribute >> belongs; - - global_element >> belongs; - global_attribute >> belongs; - - complex_names >> attribute; - complex_names >> any_attribute; - complex_names >> any_flat; - complex_names >> element_flat; - - contains_particle >> any; - contains_particle >> element; - - belongs >> list; - belongs >> union_; - belongs >> complex; - belongs >> enumeration; - - // - // - Traversal::Argumented argumented; - list >> argumented; - union_ >> argumented; - - argumented >> list; - argumented >> union_; - argumented >> complex; - argumented >> enumeration; - - // - // - Enumerator enumerator; - enumeration_names >> enumerator; - - // - // - if (tu->annotated_p ()) - wcout << ind << "<" << tu->annotation ().documentation () << ">" - << endl; - - wcout << ind << "primary" << endl; - tu->context ().set ("seen", true); - schema.dispatch (*tu); - - return 0; - } - catch (InvalidSchema const&) - { - // Diagnostic has already been issued. - } - catch (SemanticGraph::InvalidPath const&) - { - wcerr << argv[0] << ": error: '" << argv[1] << "' is not a valid " - << "filesystem path" << endl; - } - - return 1; -} diff --git a/tests/dump/makefile b/tests/dump/makefile deleted file mode 100644 index 18f18de..0000000 --- a/tests/dump/makefile +++ /dev/null @@ -1,54 +0,0 @@ -# file : tests/dump/makefile -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make - -cxx_tun := driver.cxx -cxx_obj := $(addprefix $(out_base)/,$(cxx_tun:.cxx=.o)) -cxx_od := $(cxx_obj:.o=.o.d) - -xsd-fe.l := $(out_root)/xsd-frontend/xsd-frontend.l -xsd-fe.l.cpp-options := $(out_root)/xsd-frontend/xsd-frontend.l.cpp-options - -driver := $(out_base)/driver -clean := $(out_base)/.clean - -# Build. -# -$(driver): $(cxx_obj) $(xsd-fe.l) - -$(cxx_obj) $(cxx_od): $(xsd-fe.l.cpp-options) - -$(call include-dep,$(cxx_od)) - -# Convenience alias for default target. -# -$(out_base)/: $(driver) - -# 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)/xsd-frontend/makefile) diff --git a/tests/makefile b/tests/makefile deleted file mode 100644 index 103accf..0000000 --- a/tests/makefile +++ /dev/null @@ -1,15 +0,0 @@ -# file : tests/makefile -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../build/bootstrap.make - -default := $(out_base)/ -test := $(out_base)/.test -clean := $(out_base)/.clean - -$(default): $(out_base)/dump/ $(out_base)/schema/ -$(test): $(out_base)/schema/.test -$(clean): $(out_base)/dump/.clean $(out_base)/schema/.clean - -$(call import,$(src_base)/dump/makefile) -$(call import,$(src_base)/schema/makefile) diff --git a/tests/schema/annotation.testscript b/tests/schema/annotation.testscript new file mode 100644 index 0000000..3f8a96b --- /dev/null +++ b/tests/schema/annotation.testscript @@ -0,0 +1,298 @@ +# file : tests/schema/annotation.testscript +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +: basic +: +{ + cat <=test.xsd; + + + + + schema documentation + + + + + list type documentation + + + + + + + union type documentation + + + + + + + enumeration type documentation + + + + + enumerator documentation (male) + + + + + enumerator documentation (female) + + + + + + + + complex type documentation + + + + + local element efoo documentation + + + + + local element ebar documentation + + + + + + nested local element efoo documentation + + + + + + nested local attribute afoo documentation + + + + + + + local element ebaz documentation + + + + + any documentation + + + + + + local attribute afoo documentation + + + + + local attribute abar documentation + + + + list type documentation + + + + + + + local attribute abaz documentation + + + + + anyAttribute documentation + + + + + + + global element documentation + + + + + + global attribute documentation + + + + + EOI + + $* test.xsd >>EOO + + primary + { + namespace test + { + + list list http://www.w3.org/2001/XMLSchema#string + + union union http://www.w3.org/2001/XMLSchema#int http://www.w3.org/2001/XMLSchema#string + + enumeration enum: http://www.w3.org/2001/XMLSchema#string + { + + enumerator male + + enumerator female + } + + complex type + { + + element efoo + + element ebar + + element ebaz + + any 'any #0' + + optional attribute afoo http://www.w3.org/2001/XMLSchema#string + + optional attribute abar + { + + list http://www.w3.org/2001/XMLSchema#string + } + + optional attribute abaz http://www.w3.org/2001/XMLSchema#string + + any-attribute 'any-attribute #0' + [1, 1] sequence + { + [1, 1] element efoo http://www.w3.org/2001/XMLSchema#string + [1, 1] element ebar + { + complex + { + + element efoo + + optional attribute afoo http://www.w3.org/2001/XMLSchema#string + [1, 1] sequence + { + [1, 1] element efoo http://www.w3.org/2001/XMLSchema#string + } + } + } + [1, 1] element ebaz http://www.w3.org/2001/XMLSchema#string + [1, 1] any 'any #0' + } + } + + element ebaz http://www.w3.org/2001/XMLSchema#string + + attribute abaz http://www.w3.org/2001/XMLSchema#string + } + } + EOO +} + +: refs +: +{ + cat <=refs.xsd; + + + + + + + + + + + + + + + + + + + group element efoo documentation + + + + + + + + + global element ebar documentation + + + + + + + group attribute afoo documentation + + + + + + + + global attribute abar documentation + + + + + + global attribute abaz documentation + + + + + EOI + + $* refs.xsd >>EOO + primary + { + namespace test + { + complex type + { + + element ebar + + element efoo + + element ebar + + optional attribute abar http://www.w3.org/2001/XMLSchema#string + + optional attribute afoo http://www.w3.org/2001/XMLSchema#string + + optional attribute abaz http://www.w3.org/2001/XMLSchema#string + [1, 1] sequence + { + [1, 1] element ebar http://www.w3.org/2001/XMLSchema#string + [1, 1] choice + { + [1, 1] element efoo http://www.w3.org/2001/XMLSchema#string + [1, 1] element ebar http://www.w3.org/2001/XMLSchema#string + } + } + } + + element ebar http://www.w3.org/2001/XMLSchema#string + + attribute abar http://www.w3.org/2001/XMLSchema#string + + attribute abaz http://www.w3.org/2001/XMLSchema#string + } + } + EOO +} diff --git a/tests/schema/annotation/makefile b/tests/schema/annotation/makefile deleted file mode 100644 index 8c3d805..0000000 --- a/tests/schema/annotation/makefile +++ /dev/null @@ -1,33 +0,0 @@ -# file : tests/schema/annotation/makefile -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make - -tests := 000 001 - -driver := $(out_root)/tests/dump/driver -test := $(out_base)/.test -clean := $(out_base)/.clean - -# Convenience 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-%.xsd $(src_base)/test-%.std - $(call message,test $(out_base)/$*,$(driver) $(src_base)/test-$*.xsd | diff -u $(src_base)/test-$*.std -) - -# Clean. -# -$(clean): - -# Dependencies. -# -$(call import,$(src_root)/tests/dump/makefile) diff --git a/tests/schema/annotation/test-000.std b/tests/schema/annotation/test-000.std deleted file mode 100644 index 15f3e89..0000000 --- a/tests/schema/annotation/test-000.std +++ /dev/null @@ -1,67 +0,0 @@ - -primary -{ - namespace test - { - - list list http://www.w3.org/2001/XMLSchema#string - - union union http://www.w3.org/2001/XMLSchema#int http://www.w3.org/2001/XMLSchema#string - - enumeration enum: http://www.w3.org/2001/XMLSchema#string - { - - enumerator male - - enumerator female - } - - complex type - { - - element efoo - - element ebar - - element ebaz - - any 'any #0' - - optional attribute afoo http://www.w3.org/2001/XMLSchema#string - - optional attribute abar - { - - list http://www.w3.org/2001/XMLSchema#string - } - - optional attribute abaz http://www.w3.org/2001/XMLSchema#string - - any-attribute 'any-attribute #0' - [1, 1] sequence - { - [1, 1] element efoo http://www.w3.org/2001/XMLSchema#string - [1, 1] element ebar - { - complex - { - - element efoo - - optional attribute afoo http://www.w3.org/2001/XMLSchema#string - [1, 1] sequence - { - [1, 1] element efoo http://www.w3.org/2001/XMLSchema#string - } - } - } - [1, 1] element ebaz http://www.w3.org/2001/XMLSchema#string - [1, 1] any 'any #0' - } - } - - element ebaz http://www.w3.org/2001/XMLSchema#string - - attribute abaz http://www.w3.org/2001/XMLSchema#string - } -} diff --git a/tests/schema/annotation/test-000.xsd b/tests/schema/annotation/test-000.xsd deleted file mode 100644 index f768b45..0000000 --- a/tests/schema/annotation/test-000.xsd +++ /dev/null @@ -1,120 +0,0 @@ - - - - - schema documentation - - - - - list type documentation - - - - - - - union type documentation - - - - - - - enumeration type documentation - - - - - enumerator documentation (male) - - - - - enumerator documentation (female) - - - - - - - - complex type documentation - - - - - local element efoo documentation - - - - - local element ebar documentation - - - - - - nested local element efoo documentation - - - - - - nested local attribute afoo documentation - - - - - - - local element ebaz documentation - - - - - any documentation - - - - - - local attribute afoo documentation - - - - - local attribute abar documentation - - - - list type documentation - - - - - - - local attribute abaz documentation - - - - - anyAttribute documentation - - - - - - - global element documentation - - - - - - global attribute documentation - - - - diff --git a/tests/schema/annotation/test-001.std b/tests/schema/annotation/test-001.std deleted file mode 100644 index 9e2c99a..0000000 --- a/tests/schema/annotation/test-001.std +++ /dev/null @@ -1,36 +0,0 @@ -primary -{ - namespace test - { - complex type - { - - element ebar - - element efoo - - element ebar - - optional attribute abar http://www.w3.org/2001/XMLSchema#string - - optional attribute afoo http://www.w3.org/2001/XMLSchema#string - - optional attribute abaz http://www.w3.org/2001/XMLSchema#string - [1, 1] sequence - { - [1, 1] element ebar http://www.w3.org/2001/XMLSchema#string - [1, 1] choice - { - [1, 1] element efoo http://www.w3.org/2001/XMLSchema#string - [1, 1] element ebar http://www.w3.org/2001/XMLSchema#string - } - } - } - - element ebar http://www.w3.org/2001/XMLSchema#string - - attribute abar http://www.w3.org/2001/XMLSchema#string - - attribute abaz http://www.w3.org/2001/XMLSchema#string - } -} diff --git a/tests/schema/annotation/test-001.xsd b/tests/schema/annotation/test-001.xsd deleted file mode 100644 index 286f63a..0000000 --- a/tests/schema/annotation/test-001.xsd +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - - - - - - - - - - - - - group element efoo documentation - - - - - - - - - global element ebar documentation - - - - - - - group attribute afoo documentation - - - - - - - - global attribute abar documentation - - - - - - global attribute abaz documentation - - - - diff --git a/tests/schema/anonymous.testscript b/tests/schema/anonymous.testscript new file mode 100644 index 0000000..2dbc184 --- /dev/null +++ b/tests/schema/anonymous.testscript @@ -0,0 +1,181 @@ +# file : tests/schema/anonymous.testscript +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +test.options += --anonymous + +: basic +: +{ + cat <=test.xsd; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + EOI + + $* test.xsd >>EOO + anonymous: test anon_item anon + anonymous: test anon_nested_item anon_nested + anonymous: test anon_nested_item_base anon_nested_item + primary + { + namespace test + { + list named http://www.w3.org/2001/XMLSchema#string + enumeration anon_item: http://www.w3.org/2001/XMLSchema#string + { + enumerator male + enumerator female + } + list anon test#anon_item1 + list anon_nested test#anon_nested_item + enumeration anon_item1: http://www.w3.org/2001/XMLSchema#string + { + enumerator male + enumerator female + } + enumeration anon_nested_item: test#anon_nested_item_base + { + enumerator male + enumerator female + } + complex anon_nested_item_base: http://www.w3.org/2001/XMLSchema#string + { + } + } + } + EOO +} + +: complex +: +{ + cat <=test.xsd; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + EOI + + $* test.xsd >>EOO + anonymous: test anon_base anon + anonymous: test anon_nested_base anon_nested + anonymous: test anon_nested_base_base anon_nested_base + primary + { + namespace test + { + enumeration named: http://www.w3.org/2001/XMLSchema#string + { + enumerator male + enumerator female + } + enumeration anon_base: http://www.w3.org/2001/XMLSchema#string + { + enumerator male + enumerator female + } + enumeration anon: test#anon_base1 + { + enumerator male + enumerator female + } + enumeration anon_nested: test#anon_nested_base + { + enumerator male + enumerator female + } + complex anon_base1: http://www.w3.org/2001/XMLSchema#string + { + } + complex anon_nested_base: test#anon_nested_base_base + { + } + complex anon_nested_base_base: http://www.w3.org/2001/XMLSchema#string + { + } + } + } + EOO +} diff --git a/tests/schema/anonymous/makefile b/tests/schema/anonymous/makefile deleted file mode 100644 index 345bf11..0000000 --- a/tests/schema/anonymous/makefile +++ /dev/null @@ -1,33 +0,0 @@ -# file : tests/schema/annotation/makefile -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make - -tests := 000 001 - -driver := $(out_root)/tests/dump/driver -test := $(out_base)/.test -clean := $(out_base)/.clean - -# Convenience 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-%.xsd $(src_base)/test-%.std - $(call message,test $(out_base)/$*,$(driver) --anonymous $(src_base)/test-$*.xsd | diff -u $(src_base)/test-$*.std -) - -# Clean. -# -$(clean): - -# Dependencies. -# -$(call import,$(src_root)/tests/dump/makefile) diff --git a/tests/schema/anonymous/test-000.std b/tests/schema/anonymous/test-000.std deleted file mode 100644 index 1f33cb0..0000000 --- a/tests/schema/anonymous/test-000.std +++ /dev/null @@ -1,30 +0,0 @@ -anonymous: test anon_item anon -anonymous: test anon_nested_item anon_nested -anonymous: test anon_nested_item_base anon_nested_item -primary -{ - namespace test - { - list named http://www.w3.org/2001/XMLSchema#string - enumeration anon_item: http://www.w3.org/2001/XMLSchema#string - { - enumerator male - enumerator female - } - list anon test#anon_item1 - list anon_nested test#anon_nested_item - enumeration anon_item1: http://www.w3.org/2001/XMLSchema#string - { - enumerator male - enumerator female - } - enumeration anon_nested_item: test#anon_nested_item_base - { - enumerator male - enumerator female - } - complex anon_nested_item_base: http://www.w3.org/2001/XMLSchema#string - { - } - } -} diff --git a/tests/schema/anonymous/test-000.xsd b/tests/schema/anonymous/test-000.xsd deleted file mode 100644 index ece8f4a..0000000 --- a/tests/schema/anonymous/test-000.xsd +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/schema/anonymous/test-001.std b/tests/schema/anonymous/test-001.std deleted file mode 100644 index cc3f2d1..0000000 --- a/tests/schema/anonymous/test-001.std +++ /dev/null @@ -1,38 +0,0 @@ -anonymous: test anon_base anon -anonymous: test anon_nested_base anon_nested -anonymous: test anon_nested_base_base anon_nested_base -primary -{ - namespace test - { - enumeration named: http://www.w3.org/2001/XMLSchema#string - { - enumerator male - enumerator female - } - enumeration anon_base: http://www.w3.org/2001/XMLSchema#string - { - enumerator male - enumerator female - } - enumeration anon: test#anon_base1 - { - enumerator male - enumerator female - } - enumeration anon_nested: test#anon_nested_base - { - enumerator male - enumerator female - } - complex anon_base1: http://www.w3.org/2001/XMLSchema#string - { - } - complex anon_nested_base: test#anon_nested_base_base - { - } - complex anon_nested_base_base: http://www.w3.org/2001/XMLSchema#string - { - } - } -} diff --git a/tests/schema/anonymous/test-001.xsd b/tests/schema/anonymous/test-001.xsd deleted file mode 100644 index 4a8414f..0000000 --- a/tests/schema/anonymous/test-001.xsd +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/schema/attribute-group.testscript b/tests/schema/attribute-group.testscript new file mode 100644 index 0000000..e2a64a6 --- /dev/null +++ b/tests/schema/attribute-group.testscript @@ -0,0 +1,102 @@ +# file : tests/schema/attribute-group.testscript +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +: multiple-ref-levels +: +{ + cat <=test.xsd; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + EOI + + $* test.xsd >>EOO + primary + { + namespace test + { + complex type + { + optional attribute foo2 http://www.w3.org/2001/XMLSchema#string + required attribute bar2 http://www.w3.org/2001/XMLSchema#string + optional attribute foo3 http://www.w3.org/2001/XMLSchema#string + required attribute bar3 http://www.w3.org/2001/XMLSchema#string + } + attribute foo2 http://www.w3.org/2001/XMLSchema#string + attribute bar2 http://www.w3.org/2001/XMLSchema#string + attribute foo3 http://www.w3.org/2001/XMLSchema#string + attribute bar3 http://www.w3.org/2001/XMLSchema#string + } + } + EOO +} + +: any-attr +: +{ + cat <=test.xsd; + + + + + + + + + + + + + + + + + + + + + EOI + + $* test.xsd >>EOO + primary + { + namespace test + { + complex type + { + any-attribute 'any-attribute #1' + optional attribute foo http://www.w3.org/2001/XMLSchema#string + any-attribute 'any-attribute #0' + } + } + } + EOO +} diff --git a/tests/schema/attribute-group/makefile b/tests/schema/attribute-group/makefile deleted file mode 100644 index 2caa99f..0000000 --- a/tests/schema/attribute-group/makefile +++ /dev/null @@ -1,33 +0,0 @@ -# file : tests/schema/attribute-group/makefile -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make - -tests := 000 001 - -driver := $(out_root)/tests/dump/driver -test := $(out_base)/.test -clean := $(out_base)/.clean - -# Convenience 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-%.xsd $(src_base)/test-%.std - $(call message,test $(out_base)/$*,$(driver) $(src_base)/test-$*.xsd | diff -u $(src_base)/test-$*.std -) - -# Clean. -# -$(clean): - -# Dependencies. -# -$(call import,$(src_root)/tests/dump/makefile) diff --git a/tests/schema/attribute-group/test-000.std b/tests/schema/attribute-group/test-000.std deleted file mode 100644 index 61ad802..0000000 --- a/tests/schema/attribute-group/test-000.std +++ /dev/null @@ -1,17 +0,0 @@ -primary -{ - namespace test - { - complex type - { - optional attribute foo2 http://www.w3.org/2001/XMLSchema#string - required attribute bar2 http://www.w3.org/2001/XMLSchema#string - optional attribute foo3 http://www.w3.org/2001/XMLSchema#string - required attribute bar3 http://www.w3.org/2001/XMLSchema#string - } - attribute foo2 http://www.w3.org/2001/XMLSchema#string - attribute bar2 http://www.w3.org/2001/XMLSchema#string - attribute foo3 http://www.w3.org/2001/XMLSchema#string - attribute bar3 http://www.w3.org/2001/XMLSchema#string - } -} diff --git a/tests/schema/attribute-group/test-000.xsd b/tests/schema/attribute-group/test-000.xsd deleted file mode 100644 index 9087a2b..0000000 --- a/tests/schema/attribute-group/test-000.xsd +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/schema/attribute-group/test-001.std b/tests/schema/attribute-group/test-001.std deleted file mode 100644 index 54a1e96..0000000 --- a/tests/schema/attribute-group/test-001.std +++ /dev/null @@ -1,12 +0,0 @@ -primary -{ - namespace test - { - complex type - { - any-attribute 'any-attribute #1' - optional attribute foo http://www.w3.org/2001/XMLSchema#string - any-attribute 'any-attribute #0' - } - } -} diff --git a/tests/schema/attribute-group/test-001.xsd b/tests/schema/attribute-group/test-001.xsd deleted file mode 100644 index dc44a70..0000000 --- a/tests/schema/attribute-group/test-001.xsd +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/tests/schema/buildfile b/tests/schema/buildfile new file mode 100644 index 0000000..f3e5b9c --- /dev/null +++ b/tests/schema/buildfile @@ -0,0 +1,6 @@ +# file : tests/schema/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd-frontend%lib{xsd-frontend} + +exe{driver}: {hxx cxx}{*} $libs testscript{*} diff --git a/tests/schema/default.testscript b/tests/schema/default.testscript new file mode 100644 index 0000000..e8bcd23 --- /dev/null +++ b/tests/schema/default.testscript @@ -0,0 +1,99 @@ +# file : tests/schema/default.testscript +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +: qual +: +{ + cat <=test.xsd; + + + + + + + + + + + + + + + + + + + + + + + + EOI + + $* test.xsd >>EOO + primary + { + namespace test + { + complex type + { + element e1=123 + element e2==456 + element e3=unqual + element e4==test#t:foo + element e5=foo#x:bar + optional attribute a1=123 http://www.w3.org/2001/XMLSchema#int + optional attribute a2==456 http://www.w3.org/2001/XMLSchema#int + optional attribute a3=foo#x:bar test#qname + [1, 1] sequence + { + [1, 1] element e1=123 http://www.w3.org/2001/XMLSchema#int + [1, 1] element e2==456 http://www.w3.org/2001/XMLSchema#int + [1, 1] element e3=unqual http://www.w3.org/2001/XMLSchema#QName + [1, 1] element e4==test#t:foo http://www.w3.org/2001/XMLSchema#QName + [1, 1] element e5=foo#x:bar http://www.w3.org/2001/XMLSchema#QName + } + } + complex qname: http://www.w3.org/2001/XMLSchema#QName + { + } + } + } + EOO +} + +: unqual +: +{ + cat <=test.xsd; + + + + + + + + + + + + EOI + + $* test.xsd >>EOO + primary + { + namespace test + { + complex type + { + element e=foo#unqual + optional attribute a=foo#unqual http://www.w3.org/2001/XMLSchema#QName + [1, 1] sequence + { + [1, 1] element e=foo#unqual http://www.w3.org/2001/XMLSchema#QName + } + } + } + } + EOO +} diff --git a/tests/schema/default/makefile b/tests/schema/default/makefile deleted file mode 100644 index 3f5f31e..0000000 --- a/tests/schema/default/makefile +++ /dev/null @@ -1,33 +0,0 @@ -# file : tests/schema/default/makefile -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make - -tests := 000 001 - -driver := $(out_root)/tests/dump/driver -test := $(out_base)/.test -clean := $(out_base)/.clean - -# Convenience 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-%.xsd $(src_base)/test-%.std - $(call message,test $(out_base)/$*,$(driver) --anonymous $(src_base)/test-$*.xsd | diff -u $(src_base)/test-$*.std -) - -# Clean. -# -$(clean): - -# Dependencies. -# -$(call import,$(src_root)/tests/dump/makefile) diff --git a/tests/schema/default/test-000.std b/tests/schema/default/test-000.std deleted file mode 100644 index efa1140..0000000 --- a/tests/schema/default/test-000.std +++ /dev/null @@ -1,28 +0,0 @@ -primary -{ - namespace test - { - complex type - { - element e1=123 - element e2==456 - element e3=unqual - element e4==test#t:foo - element e5=foo#x:bar - optional attribute a1=123 http://www.w3.org/2001/XMLSchema#int - optional attribute a2==456 http://www.w3.org/2001/XMLSchema#int - optional attribute a3=foo#x:bar test#qname - [1, 1] sequence - { - [1, 1] element e1=123 http://www.w3.org/2001/XMLSchema#int - [1, 1] element e2==456 http://www.w3.org/2001/XMLSchema#int - [1, 1] element e3=unqual http://www.w3.org/2001/XMLSchema#QName - [1, 1] element e4==test#t:foo http://www.w3.org/2001/XMLSchema#QName - [1, 1] element e5=foo#x:bar http://www.w3.org/2001/XMLSchema#QName - } - } - complex qname: http://www.w3.org/2001/XMLSchema#QName - { - } - } -} diff --git a/tests/schema/default/test-000.xsd b/tests/schema/default/test-000.xsd deleted file mode 100644 index bfaedc5..0000000 --- a/tests/schema/default/test-000.xsd +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/schema/default/test-001.std b/tests/schema/default/test-001.std deleted file mode 100644 index 1b84a07..0000000 --- a/tests/schema/default/test-001.std +++ /dev/null @@ -1,15 +0,0 @@ -primary -{ - namespace test - { - complex type - { - element e=foo#unqual - optional attribute a=foo#unqual http://www.w3.org/2001/XMLSchema#QName - [1, 1] sequence - { - [1, 1] element e=foo#unqual http://www.w3.org/2001/XMLSchema#QName - } - } - } -} diff --git a/tests/schema/default/test-001.xsd b/tests/schema/default/test-001.xsd deleted file mode 100644 index 5ee0507..0000000 --- a/tests/schema/default/test-001.xsd +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/tests/schema/driver.cxx b/tests/schema/driver.cxx new file mode 100644 index 0000000..09ef2e5 --- /dev/null +++ b/tests/schema/driver.cxx @@ -0,0 +1,724 @@ +// file : tests/schema/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +#include +#include +#include +#include + +#include +#include + +#include + +using namespace std; +using namespace XSDFrontend; + +static unsigned long indent; + +std::wostream& +ind (std::wostream& os) +{ + for (unsigned long n (0); n < indent; ++n) + os << L" "; + + return os; +} + +namespace +{ + // Nameable which is named in the namespace scope. + // + String + ref_name (SemanticGraph::Nameable& n) + { + String const& scope (n.scope ().name ()); + + return scope + (scope.empty () ? L"" : L"#") + n.name (); + } + + struct List: Traversal::List + { + virtual void + traverse (Type& l) + { + if (l.annotated_p ()) + wcout << ind << "<" << l.annotation ().documentation () << ">" + << endl; + + wcout << ind << "list " << + (l.named_p () ? l.name () : String ("")); + + SemanticGraph::Type& t (l.argumented ().type ()); + + if (t.named_p ()) + wcout << " " << ref_name (t) << endl; + else + { + wcout << endl + << ind << "{" << endl; + indent++; + + edge_traverser ().dispatch (l.argumented ()); + + indent--; + wcout << ind << "}" << endl; + } + } + }; + + struct Union: Traversal::Union + { + virtual void + traverse (Type& u) + { + if (u.annotated_p ()) + wcout << ind << "<" << u.annotation ().documentation () << ">" + << endl; + + wcout << ind << "union " << + (u.named_p () ? u.name () : String ("")); + + for (Type::ArgumentedIterator i (u.argumented_begin ()); + i != u.argumented_end (); ++i) + { + SemanticGraph::Type& t (i->type ()); + + if (t.named_p ()) + wcout << " " << ref_name (t); + else + { + wcout << endl + << ind << "{" << endl; + indent++; + + edge_traverser ().dispatch (*i); + + indent--; + wcout << ind << "}" << endl; + } + } + + wcout << endl; + } + }; + + struct Enumerator: Traversal::Enumerator + { + virtual void + traverse (Type& e) + { + if (e.annotated_p ()) + wcout << ind << "<" << e.annotation ().documentation () << ">" + << endl; + + wcout << ind << "enumerator " << e.name () << endl; + } + }; + + struct Enumeration: Traversal::Enumeration + { + virtual void + traverse (Type& e) + { + if (e.annotated_p ()) + wcout << ind << "<" << e.annotation ().documentation () << ">" + << endl; + + wcout << ind << "enumeration " << + (e.named_p () ? e.name () : String ("")) << ": " << + ref_name (e.inherits ().base ()) << endl + << ind << "{" << endl; + + indent++; + Traversal::Enumeration::traverse (e); + indent--; + + wcout << ind << "}" << endl; + } + }; + + struct ContainsParticle: Traversal::ContainsParticle + { + virtual void + traverse (Type& cp) + { + wcout << ind << "[" << cp.min () << ", "; + + if (cp.max () == 0) + wcout << "unbounded] "; + else + wcout << cp.max () << "] "; + + Traversal::ContainsParticle::traverse (cp); + } + }; + + struct ContainsCompositor: Traversal::ContainsCompositor + { + virtual void + traverse (Type& cc) + { + wcout << ind << "[" << cc.min () << ", "; + + if (cc.max () == 0) + wcout << "unbounded] "; + else + wcout << cc.max () << "] "; + + Traversal::ContainsCompositor::traverse (cc); + } + }; + + struct Compositor: Traversal::All, + Traversal::Choice, + Traversal::Sequence + { + virtual void + traverse (SemanticGraph::All& a) + { + wcout << "all" << endl + << ind << "{" << endl; + + indent++; + + Traversal::All::traverse (a); + + indent--; + + wcout << ind << "}" << endl; + } + + virtual void + traverse (SemanticGraph::Choice& c) + { + wcout << "choice" << endl + << ind << "{" << endl; + + indent++; + + Traversal::Choice::traverse (c); + + indent--; + + wcout << ind << "}" << endl; + } + + virtual void + traverse (SemanticGraph::Sequence& s) + { + wcout << "sequence" << endl + << ind << "{" << endl; + + indent++; + + Traversal::Sequence::traverse (s); + + indent--; + + wcout << ind << "}" << endl; + } + }; + + struct Attribute: Traversal::Attribute + { + virtual void + traverse (Type& a) + { + if (a.annotated_p ()) + wcout << ind << "<" << a.annotation ().documentation () << ">" + << endl; + + wcout << ind << (a.optional_p () ? "optional" : "required") + << " attribute " << a.name (); + + if (a.fixed_p ()) + wcout << "==" << a.value (); + else if (a.default_p ()) + wcout << "=" << a.value (); + + SemanticGraph::Type& t (a.type ()); + + if (t.named_p ()) + wcout << " " << ref_name (t) << endl; + else + { + wcout << endl + << ind << "{" << endl; + indent++; + + belongs (a); + + indent--; + wcout << ind << "}" << endl; + } + } + }; + + struct AnyAttribute: Traversal::AnyAttribute + { + virtual void + traverse (Type& a) + { + if (a.annotated_p ()) + wcout << ind << "<" << a.annotation ().documentation () << ">" + << endl; + + wcout << ind << "any-attribute '" << a.name () << "'" << endl; + } + }; + + struct Element: Traversal::Element + { + virtual void + traverse (Type& e) + { + wcout << "element " << e.name (); + + if (e.fixed_p ()) + wcout << "==" << e.value (); + else if (e.default_p ()) + wcout << "=" << e.value (); + + SemanticGraph::Type& t (e.type ()); + + if (t.named_p ()) + wcout << " " << ref_name (t) << endl; + else + { + wcout << endl + << ind << "{" << endl; + indent++; + + belongs (e); + + indent--; + wcout << ind << "}" << endl; + } + } + }; + + struct ElementFlat: Traversal::Element + { + virtual void + traverse (Type& e) + { + if (e.annotated_p ()) + wcout << ind << "<" << e.annotation ().documentation () << ">" + << endl; + + wcout << ind << "element " << e.name (); + + if (e.fixed_p ()) + wcout << "==" << e.value (); + else if (e.default_p ()) + wcout << "=" << e.value (); + + wcout << endl; + } + }; + + struct Any: Traversal::Any + { + virtual void + traverse (Type& a) + { + wcout << "any '" << a.name () << "'" << endl; + } + }; + + struct AnyFlat: Traversal::Any + { + virtual void + traverse (Type& a) + { + if (a.annotated_p ()) + wcout << ind << "<" << a.annotation ().documentation () << ">" + << endl; + + wcout << ind << "any '" << a.name () << "'" << endl; + } + }; + + struct Complex: Traversal::Complex + { + virtual void + traverse (Type& c) + { + // Anonymous type definition can recursively refer to itself. + // + if (c.context ().count ("seen")) + { + wcout << ind << "complex " << endl; + return; + } + + c.context ().set ("seen", true); + + if (c.annotated_p ()) + wcout << ind << "<" << c.annotation ().documentation () << ">" + << endl; + + wcout << ind << "complex " << + (c.named_p () ? c.name () : String ("")); + + if (c.inherits_p ()) + wcout << ": " << ref_name (c.inherits ().base ()); + + wcout << endl + << ind << "{" << endl; + indent++; + + Traversal::Complex::traverse (c); + + indent--; + wcout << ind << "}" << endl; + + c.context ().remove ("seen"); + } + }; + + struct GlobalAttribute: Traversal::Attribute + { + virtual void + traverse (Type& a) + { + if (a.annotated_p ()) + wcout << ind << "<" << a.annotation ().documentation () << ">" + << endl; + + wcout << ind << "attribute " << a.name (); + + if (a.fixed_p ()) + wcout << "==" << a.value (); + else if (a.default_p ()) + wcout << "=" << a.value (); + + SemanticGraph::Type& t (a.type ()); + + if (t.named_p ()) + wcout << " " << ref_name (t) << endl; + else + { + wcout << endl + << ind << "{" << endl; + indent++; + + belongs (a); + + indent--; + wcout << ind << "}" << endl; + } + } + }; + + struct GlobalElement: Traversal::Element + { + virtual void + traverse (Type& e) + { + if (e.annotated_p ()) + wcout << ind << "<" << e.annotation ().documentation () << ">" + << endl; + + wcout << ind << "element " << e.name (); + + if (e.fixed_p ()) + wcout << "==" << e.value (); + else if (e.default_p ()) + wcout << "=" << e.value (); + + SemanticGraph::Type& t (e.type ()); + + if (t.named_p ()) + wcout << " " << ref_name (t) << endl; + else + { + wcout << endl + << ind << "{" << endl; + indent++; + + belongs (e); + + indent--; + wcout << ind << "}" << endl; + } + } + }; + + struct Namespace: Traversal::Namespace + { + virtual void + traverse (Type& n) + { + wcout << ind << "namespace " << n.name () << endl + << ind << "{" << endl; + indent++; + Traversal::Namespace::traverse (n); + indent--; + wcout << ind << "}" << endl; + } + }; + + // Go into implied/included/imported schemas while making sure + // we don't recurse forever. + // + struct Uses: Traversal::Imports, + Traversal::Includes, + Traversal::Sources + //Traversal::Implies @@ Need a --with-implies option + { + virtual void + traverse (SemanticGraph::Imports& i) + { + if (traverse_uses (i, "imports")) + Traversal::Imports::traverse (i); + } + + virtual void + traverse (SemanticGraph::Includes& i) + { + if (traverse_uses (i, "includes")) + Traversal::Includes::traverse (i); + } + + virtual void + traverse (SemanticGraph::Sources& s) + { + if (traverse_uses (s, "sources")) + Traversal::Sources::traverse (s); + } + + /* + virtual void + traverse (SemanticGraph::Implies& i) + { + if (traverse_uses (i, "implies")) + Traversal::Implies::traverse (i); + } + */ + + bool + traverse_uses (SemanticGraph::Uses& u, String const& type) + { + SemanticGraph::Schema& s (u.schema ()); + + if (s.context ().count ("seen")) + { + wcout << ind << "recursively " << type << " " << u.path () << endl; + return false; + } + + s.context ().set ("seen", true); + + if (s.annotated_p ()) + wcout << ind << "<" << s.annotation ().documentation () << ">" << endl; + + wcout << ind << type << " " << u.path () << endl; + + return true; + } + }; + + struct Schema: Traversal::Schema + { + virtual void + traverse (Type& s) + { + wcout << ind << "{" << endl; + indent++; + Traversal::Schema::traverse (s); + indent--; + wcout << ind << "}" << endl; + } + }; +} + +struct AnonymousNameTranslator: Transformations::AnonymousNameTranslator +{ + virtual String + translate (String const& /*file*/, + String const& ns, + String const& name, + String const& xpath) + { + wcout << "anonymous: " << ns << " " << name << " " << xpath << endl; + return name; + } +}; + +int +main (int argc, char* argv[]) +{ + try + { + if (argc < 2) + { + wcerr << argv[0] << ": error: no input file." << endl; + return 1; + } + + // Parse options. + // + int i (1); + bool anon (false); + bool enum_synth (false); + + for (; i < argc; ++i) + { + if (argv[i] == NarrowString ("--anonymous")) + anon = true; + else if (argv[i] == NarrowString ("--enum-synthesis")) + enum_synth = true; + else + break; + } + + // Parse schema. + // + SemanticGraph::Path path (argv[i]); + + Parser parser (true, false, true); + unique_ptr tu (parser.parse (path)); + + // + // + if (anon) + { + try + { + AnonymousNameTranslator transl; + Transformations::Anonymous transf (transl); + transf.transform (*tu, path, true); + } + catch (Transformations::Anonymous::Failed const&) + { + // Diagnostics has already been issued. + // + return 1; + } + } + + // + // + if (enum_synth) + { + Transformations::EnumSynthesis transf; + transf.transform (*tu, path); + } + + // + // + Schema schema; + Uses uses; + + schema >> uses >> schema; + + Traversal::Names schema_names; + Namespace ns; + Traversal::Names ns_names; + + schema >> schema_names >> ns >> ns_names; + + // + // + List list; + Union union_; + Complex complex; + Enumeration enumeration; + GlobalElement global_element; + GlobalAttribute global_attribute; + + Traversal::Names complex_names; + Traversal::Names enumeration_names; + ContainsCompositor contains_compositor; + + ns_names >> list; + ns_names >> union_; + ns_names >> complex; + ns_names >> enumeration; + ns_names >> global_attribute; + ns_names >> global_element; + + complex >> complex_names; + complex >> contains_compositor; + + enumeration >> enumeration_names; + + // + // + Compositor compositor; + ContainsParticle contains_particle; + + contains_compositor >> compositor; + compositor >> contains_particle >> compositor; + + // + // + Any any; + AnyFlat any_flat; + Element element; + ElementFlat element_flat; + Attribute attribute; + AnyAttribute any_attribute; + Traversal::Belongs belongs; + + element >> belongs; + attribute >> belongs; + + global_element >> belongs; + global_attribute >> belongs; + + complex_names >> attribute; + complex_names >> any_attribute; + complex_names >> any_flat; + complex_names >> element_flat; + + contains_particle >> any; + contains_particle >> element; + + belongs >> list; + belongs >> union_; + belongs >> complex; + belongs >> enumeration; + + // + // + Traversal::Argumented argumented; + list >> argumented; + union_ >> argumented; + + argumented >> list; + argumented >> union_; + argumented >> complex; + argumented >> enumeration; + + // + // + Enumerator enumerator; + enumeration_names >> enumerator; + + // + // + if (tu->annotated_p ()) + wcout << ind << "<" << tu->annotation ().documentation () << ">" + << endl; + + wcout << ind << "primary" << endl; + tu->context ().set ("seen", true); + schema.dispatch (*tu); + + return 0; + } + catch (InvalidSchema const&) + { + // Diagnostic has already been issued. + } + catch (SemanticGraph::InvalidPath const&) + { + wcerr << argv[0] << ": error: '" << argv[1] << "' is not a valid " + << "filesystem path" << endl; + } + + return 1; +} diff --git a/tests/schema/element-group.testscript b/tests/schema/element-group.testscript new file mode 100644 index 0000000..5fb385f --- /dev/null +++ b/tests/schema/element-group.testscript @@ -0,0 +1,324 @@ +# file : tests/schema/element-group.testscript +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +: multiple-ref-levels +: +{ + cat <=test.xsd; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + EOI + + $* test.xsd >>EOO + primary + { + namespace test + { + complex type + { + element foo2 + element bar2 + element foo3 + element bar3 + [1, 1] sequence + { + [0, unbounded] choice + { + [0, 1] choice + { + [1, 1] element foo2 http://www.w3.org/2001/XMLSchema#string + [0, 1] element bar2 http://www.w3.org/2001/XMLSchema#string + } + [1, unbounded] choice + { + [1, unbounded] element foo3 http://www.w3.org/2001/XMLSchema#string + [0, unbounded] element bar3 http://www.w3.org/2001/XMLSchema#string + } + } + } + } + element foo2 http://www.w3.org/2001/XMLSchema#string + element bar2 http://www.w3.org/2001/XMLSchema#string + element foo3 http://www.w3.org/2001/XMLSchema#string + element bar3 http://www.w3.org/2001/XMLSchema#string + } + } + EOO +} + +: recursive-refs +: +{ + cat <=test.xsd; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + EOI + + $* test.xsd >>EOO + primary + { + namespace test + { + complex type + { + element foo + element bar + [1, 1] sequence + { + [1, 1] choice + { + [1, 1] element foo + { + complex + { + element foo + element bar + [1, 1] sequence + { + [1, 1] choice + { + [1, 1] element foo + { + complex + } + [1, 1] element bar + { + complex + { + element foo + element bar + [1, 1] sequence + { + [1, 1] choice + { + [1, 1] element foo + { + complex + } + [1, 1] element bar + { + complex + } + } + } + } + } + } + } + } + } + [1, 1] element bar + { + complex + { + element foo + element bar + [1, 1] sequence + { + [1, 1] choice + { + [1, 1] element foo + { + complex + { + element foo + element bar + [1, 1] sequence + { + [1, 1] choice + { + [1, 1] element foo + { + complex + } + [1, 1] element bar + { + complex + } + } + } + } + } + [1, 1] element bar + { + complex + } + } + } + } + } + } + } + } + element bar + { + complex + { + element foo + element bar + [1, 1] sequence + { + [1, 1] choice + { + [1, 1] element foo + { + complex + { + element foo + element bar + [1, 1] sequence + { + [1, 1] choice + { + [1, 1] element foo + { + complex + } + [1, 1] element bar + { + complex + } + } + } + } + } + [1, 1] element bar + { + complex + } + } + } + } + } + } + } + EOO +} + +: any +: +{ + cat <=test.xsd; + + + + + + + + + + + + + + + + + + + + + + + + + + + EOI + + $* test.xsd >>EOO + primary + { + namespace test + { + complex type + { + any 'any #1' + element foo + any 'any #0' + [1, 1] sequence + { + [0, unbounded] sequence + { + [1, 1] any 'any #1' + } + [0, unbounded] sequence + { + [1, 1] element foo http://www.w3.org/2001/XMLSchema#int + [1, 1] any 'any #0' + } + } + } + } + } + EOO +} diff --git a/tests/schema/element-group/makefile b/tests/schema/element-group/makefile deleted file mode 100644 index 41c9afe..0000000 --- a/tests/schema/element-group/makefile +++ /dev/null @@ -1,33 +0,0 @@ -# file : tests/schema/element-group/makefile -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make - -tests := 000 001 002 - -driver := $(out_root)/tests/dump/driver -test := $(out_base)/.test -clean := $(out_base)/.clean - -# Convenience 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-%.xsd $(src_base)/test-%.std - $(call message,test $(out_base)/$*,$(driver) $(src_base)/test-$*.xsd | diff -u $(src_base)/test-$*.std -) - -# Clean. -# -$(clean): - -# Dependencies. -# -$(call import,$(src_root)/tests/dump/makefile) diff --git a/tests/schema/element-group/test-000.std b/tests/schema/element-group/test-000.std deleted file mode 100644 index 1652b68..0000000 --- a/tests/schema/element-group/test-000.std +++ /dev/null @@ -1,33 +0,0 @@ -primary -{ - namespace test - { - complex type - { - element foo2 - element bar2 - element foo3 - element bar3 - [1, 1] sequence - { - [0, unbounded] choice - { - [0, 1] choice - { - [1, 1] element foo2 http://www.w3.org/2001/XMLSchema#string - [0, 1] element bar2 http://www.w3.org/2001/XMLSchema#string - } - [1, unbounded] choice - { - [1, unbounded] element foo3 http://www.w3.org/2001/XMLSchema#string - [0, unbounded] element bar3 http://www.w3.org/2001/XMLSchema#string - } - } - } - } - element foo2 http://www.w3.org/2001/XMLSchema#string - element bar2 http://www.w3.org/2001/XMLSchema#string - element foo3 http://www.w3.org/2001/XMLSchema#string - element bar3 http://www.w3.org/2001/XMLSchema#string - } -} diff --git a/tests/schema/element-group/test-000.xsd b/tests/schema/element-group/test-000.xsd deleted file mode 100644 index 1864b28..0000000 --- a/tests/schema/element-group/test-000.xsd +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/schema/element-group/test-001.std b/tests/schema/element-group/test-001.std deleted file mode 100644 index ae8c1fc..0000000 --- a/tests/schema/element-group/test-001.std +++ /dev/null @@ -1,137 +0,0 @@ -primary -{ - namespace test - { - complex type - { - element foo - element bar - [1, 1] sequence - { - [1, 1] choice - { - [1, 1] element foo - { - complex - { - element foo - element bar - [1, 1] sequence - { - [1, 1] choice - { - [1, 1] element foo - { - complex - } - [1, 1] element bar - { - complex - { - element foo - element bar - [1, 1] sequence - { - [1, 1] choice - { - [1, 1] element foo - { - complex - } - [1, 1] element bar - { - complex - } - } - } - } - } - } - } - } - } - [1, 1] element bar - { - complex - { - element foo - element bar - [1, 1] sequence - { - [1, 1] choice - { - [1, 1] element foo - { - complex - { - element foo - element bar - [1, 1] sequence - { - [1, 1] choice - { - [1, 1] element foo - { - complex - } - [1, 1] element bar - { - complex - } - } - } - } - } - [1, 1] element bar - { - complex - } - } - } - } - } - } - } - } - element bar - { - complex - { - element foo - element bar - [1, 1] sequence - { - [1, 1] choice - { - [1, 1] element foo - { - complex - { - element foo - element bar - [1, 1] sequence - { - [1, 1] choice - { - [1, 1] element foo - { - complex - } - [1, 1] element bar - { - complex - } - } - } - } - } - [1, 1] element bar - { - complex - } - } - } - } - } - } -} diff --git a/tests/schema/element-group/test-001.xsd b/tests/schema/element-group/test-001.xsd deleted file mode 100644 index c6059af..0000000 --- a/tests/schema/element-group/test-001.xsd +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/schema/element-group/test-002.std b/tests/schema/element-group/test-002.std deleted file mode 100644 index d2c60fe..0000000 --- a/tests/schema/element-group/test-002.std +++ /dev/null @@ -1,24 +0,0 @@ -primary -{ - namespace test - { - complex type - { - any 'any #1' - element foo - any 'any #0' - [1, 1] sequence - { - [0, unbounded] sequence - { - [1, 1] any 'any #1' - } - [0, unbounded] sequence - { - [1, 1] element foo http://www.w3.org/2001/XMLSchema#int - [1, 1] any 'any #0' - } - } - } - } -} diff --git a/tests/schema/element-group/test-002.xsd b/tests/schema/element-group/test-002.xsd deleted file mode 100644 index bc1bd70..0000000 --- a/tests/schema/element-group/test-002.xsd +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/schema/enumeration.testscript b/tests/schema/enumeration.testscript new file mode 100644 index 0000000..5313611 --- /dev/null +++ b/tests/schema/enumeration.testscript @@ -0,0 +1,148 @@ +# file : tests/schema/enumeration.testscript +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +test.options += --enum-synthesis + +: synthesis +: +{ + cat <=test.xsd; + + + + + + + + + + + + + + + + + + romance documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + union1 documentation + + + + + + + + + + + + + + + + + + + + + + + + + + EOI + + $* test.xsd >>EOO + primary + { + namespace test + { + complex common-base: http://www.w3.org/2001/XMLSchema#string + { + } + complex base: test#common-base + { + } + enumeration one: test#base + { + + enumerator romance + enumerator fiction + enumerator horror + } + enumeration two: test#common-base + { + enumerator horror + enumerator history + enumerator philosophy + } + enumeration three: http://www.w3.org/2001/XMLSchema#anyURI + { + enumerator foo + enumerator bar + } + enumeration union0: test#common-base + { + + enumerator romance + enumerator fiction + enumerator horror + enumerator history + enumerator philosophy + } + + enumeration union1: test#common-base + { + + enumerator romance + enumerator fiction + enumerator horror + enumerator history + enumerator philosophy + } + union union2 test#one test#union1 test#common-base + union union3 test#one test#three + complex complex1 + { + element a + [1, 1] sequence + { + [1, 1] element a test#union1 + } + } + complex complex2: test#union1 + { + } + } + } + EOO +} diff --git a/tests/schema/enumeration/makefile b/tests/schema/enumeration/makefile deleted file mode 100644 index 8981773..0000000 --- a/tests/schema/enumeration/makefile +++ /dev/null @@ -1,33 +0,0 @@ -# file : tests/schema/enumeration/makefile -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make - -tests := 000 - -driver := $(out_root)/tests/dump/driver -test := $(out_base)/.test -clean := $(out_base)/.clean - -# Convenience 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-%.xsd $(src_base)/test-%.std - $(call message,test $(out_base)/$*,$(driver) --enum-synthesis $(src_base)/test-$*.xsd | diff -u $(src_base)/test-$*.std -) - -# Clean. -# -$(clean): - -# Dependencies. -# -$(call import,$(src_root)/tests/dump/makefile) diff --git a/tests/schema/enumeration/test-000.std b/tests/schema/enumeration/test-000.std deleted file mode 100644 index 64e3065..0000000 --- a/tests/schema/enumeration/test-000.std +++ /dev/null @@ -1,62 +0,0 @@ -primary -{ - namespace test - { - complex common-base: http://www.w3.org/2001/XMLSchema#string - { - } - complex base: test#common-base - { - } - enumeration one: test#base - { - - enumerator romance - enumerator fiction - enumerator horror - } - enumeration two: test#common-base - { - enumerator horror - enumerator history - enumerator philosophy - } - enumeration three: http://www.w3.org/2001/XMLSchema#anyURI - { - enumerator foo - enumerator bar - } - enumeration union0: test#common-base - { - - enumerator romance - enumerator fiction - enumerator horror - enumerator history - enumerator philosophy - } - - enumeration union1: test#common-base - { - - enumerator romance - enumerator fiction - enumerator horror - enumerator history - enumerator philosophy - } - union union2 test#one test#union1 test#common-base - union union3 test#one test#three - complex complex1 - { - element a - [1, 1] sequence - { - [1, 1] element a test#union1 - } - } - complex complex2: test#union1 - { - } - } -} diff --git a/tests/schema/enumeration/test-000.xsd b/tests/schema/enumeration/test-000.xsd deleted file mode 100644 index 08539bf..0000000 --- a/tests/schema/enumeration/test-000.xsd +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - - - - - - - - romance documentation - - - - - - - - - - - - - - - - - - - - - - - - - - - - - union1 documentation - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/schema/makefile b/tests/schema/makefile deleted file mode 100644 index b2c2fc3..0000000 --- a/tests/schema/makefile +++ /dev/null @@ -1,23 +0,0 @@ -# file : tests/schema -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../build/bootstrap.make - -tests := \ -annotation \ -anonymous \ -attribute-group \ -default \ -element-group \ -enumeration \ -union - -default := $(out_base)/ -test := $(out_base)/.test -clean := $(out_base)/.clean - -$(default): $(addprefix $(out_base)/,$(addsuffix /,$(tests))) -$(test): $(addprefix $(out_base)/,$(addsuffix /.test,$(tests))) -$(clean): $(addprefix $(out_base)/,$(addsuffix /.clean,$(tests))) - -$(foreach t,$(tests),$(call import,$(src_base)/$t/makefile)) diff --git a/tests/schema/union.testscript b/tests/schema/union.testscript new file mode 100644 index 0000000..3294ee8 --- /dev/null +++ b/tests/schema/union.testscript @@ -0,0 +1,135 @@ +# file : tests/schema/union.testscript +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +: basic +: +{ + cat <=test.xsd; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + EOI + + $* test.xsd >>EOO + primary + { + namespace test + { + union u1 http://www.w3.org/2001/XMLSchema#int http://www.w3.org/2001/XMLSchema#string + union u2 + { + enumeration : http://www.w3.org/2001/XMLSchema#token + { + enumerator one + } + } + + { + enumeration : http://www.w3.org/2001/XMLSchema#string + { + enumerator two + } + } + + union u3 http://www.w3.org/2001/XMLSchema#int test#u1 + { + enumeration : http://www.w3.org/2001/XMLSchema#token + { + enumerator one + } + } + + { + enumeration : http://www.w3.org/2001/XMLSchema#string + { + enumerator two + } + } + + } + } + EOO +} + +: anonymous +: +{ + cat <=test.xsd; + + + + + + + + + + + + + + + + + + + + + + EOI + + $* test.xsd >>EOO + primary + { + namespace test + { + list list + { + union http://www.w3.org/2001/XMLSchema#int test#enum + } + enumeration enum: http://www.w3.org/2001/XMLSchema#string + { + enumerator male + enumerator female + } + } + } + EOO +} diff --git a/tests/schema/union/makefile b/tests/schema/union/makefile deleted file mode 100644 index a8a1ca6..0000000 --- a/tests/schema/union/makefile +++ /dev/null @@ -1,33 +0,0 @@ -# file : tests/schema/union/makefile -# license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -include $(dir $(lastword $(MAKEFILE_LIST)))../../../build/bootstrap.make - -tests := 000 001 - -driver := $(out_root)/tests/dump/driver -test := $(out_base)/.test -clean := $(out_base)/.clean - -# Convenience 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-%.xsd $(src_base)/test-%.std - $(call message,test $(out_base)/$*,$(driver) $(src_base)/test-$*.xsd | diff -u $(src_base)/test-$*.std -) - -# Clean. -# -$(clean): - -# Dependencies. -# -$(call import,$(src_root)/tests/dump/makefile) diff --git a/tests/schema/union/test-000.std b/tests/schema/union/test-000.std deleted file mode 100644 index 6f95b0c..0000000 --- a/tests/schema/union/test-000.std +++ /dev/null @@ -1,37 +0,0 @@ -primary -{ - namespace test - { - union u1 http://www.w3.org/2001/XMLSchema#int http://www.w3.org/2001/XMLSchema#string - union u2 - { - enumeration : http://www.w3.org/2001/XMLSchema#token - { - enumerator one - } - } - - { - enumeration : http://www.w3.org/2001/XMLSchema#string - { - enumerator two - } - } - - union u3 http://www.w3.org/2001/XMLSchema#int test#u1 - { - enumeration : http://www.w3.org/2001/XMLSchema#token - { - enumerator one - } - } - - { - enumeration : http://www.w3.org/2001/XMLSchema#string - { - enumerator two - } - } - - } -} diff --git a/tests/schema/union/test-000.xsd b/tests/schema/union/test-000.xsd deleted file mode 100644 index 99535de..0000000 --- a/tests/schema/union/test-000.xsd +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/schema/union/test-001.std b/tests/schema/union/test-001.std deleted file mode 100644 index f407b30..0000000 --- a/tests/schema/union/test-001.std +++ /dev/null @@ -1,15 +0,0 @@ -primary -{ - namespace test - { - list list - { - union http://www.w3.org/2001/XMLSchema#int test#enum - } - enumeration enum: http://www.w3.org/2001/XMLSchema#string - { - enumerator male - enumerator female - } - } -} diff --git a/tests/schema/union/test-001.xsd b/tests/schema/union/test-001.xsd deleted file mode 100644 index 00fd8ce..0000000 --- a/tests/schema/union/test-001.xsd +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - -- cgit v1.1