summaryrefslogtreecommitdiff
path: root/libxsd-frontend/tests
diff options
context:
space:
mode:
authorJörg Frings-Fürst <jff@merkur>2014-05-18 16:08:14 +0200
committerJörg Frings-Fürst <jff@merkur>2014-05-18 16:08:14 +0200
commita15cf65c44d5c224169c32ef5495b68c758134b7 (patch)
tree3419f58fc8e1b315ba8171910ee044c5d467c162 /libxsd-frontend/tests
Imported Upstream version 3.3.0.2upstream/3.3.0.2
Diffstat (limited to 'libxsd-frontend/tests')
-rw-r--r--libxsd-frontend/tests/dump/driver.cxx734
-rw-r--r--libxsd-frontend/tests/dump/makefile56
-rw-r--r--libxsd-frontend/tests/makefile17
-rw-r--r--libxsd-frontend/tests/schema/annotation/makefile35
-rw-r--r--libxsd-frontend/tests/schema/annotation/test-000.std67
-rw-r--r--libxsd-frontend/tests/schema/annotation/test-000.xsd120
-rw-r--r--libxsd-frontend/tests/schema/annotation/test-001.std36
-rw-r--r--libxsd-frontend/tests/schema/annotation/test-001.xsd53
-rw-r--r--libxsd-frontend/tests/schema/anonymous/makefile35
-rw-r--r--libxsd-frontend/tests/schema/anonymous/test-000.std30
-rw-r--r--libxsd-frontend/tests/schema/anonymous/test-000.xsd42
-rw-r--r--libxsd-frontend/tests/schema/anonymous/test-001.std38
-rw-r--r--libxsd-frontend/tests/schema/anonymous/test-001.xsd47
-rw-r--r--libxsd-frontend/tests/schema/attribute-group/makefile35
-rw-r--r--libxsd-frontend/tests/schema/attribute-group/test-000.std17
-rw-r--r--libxsd-frontend/tests/schema/attribute-group/test-000.xsd31
-rw-r--r--libxsd-frontend/tests/schema/attribute-group/test-001.std12
-rw-r--r--libxsd-frontend/tests/schema/attribute-group/test-001.xsd20
-rw-r--r--libxsd-frontend/tests/schema/default/makefile35
-rw-r--r--libxsd-frontend/tests/schema/default/test-000.std28
-rw-r--r--libxsd-frontend/tests/schema/default/test-000.xsd23
-rw-r--r--libxsd-frontend/tests/schema/default/test-001.std15
-rw-r--r--libxsd-frontend/tests/schema/default/test-001.xsd11
-rw-r--r--libxsd-frontend/tests/schema/element-group/makefile35
-rw-r--r--libxsd-frontend/tests/schema/element-group/test-000.std33
-rw-r--r--libxsd-frontend/tests/schema/element-group/test-000.xsd39
-rw-r--r--libxsd-frontend/tests/schema/element-group/test-001.std137
-rw-r--r--libxsd-frontend/tests/schema/element-group/test-001.xsd33
-rw-r--r--libxsd-frontend/tests/schema/element-group/test-002.std24
-rw-r--r--libxsd-frontend/tests/schema/element-group/test-002.xsd26
-rw-r--r--libxsd-frontend/tests/schema/enumeration/makefile35
-rw-r--r--libxsd-frontend/tests/schema/enumeration/test-000.std62
-rw-r--r--libxsd-frontend/tests/schema/enumeration/test-000.xsd72
-rw-r--r--libxsd-frontend/tests/schema/makefile25
-rw-r--r--libxsd-frontend/tests/schema/union/makefile35
-rw-r--r--libxsd-frontend/tests/schema/union/test-000.std37
-rw-r--r--libxsd-frontend/tests/schema/union/test-000.xsd40
-rw-r--r--libxsd-frontend/tests/schema/union/test-001.std15
-rw-r--r--libxsd-frontend/tests/schema/union/test-001.xsd21
39 files changed, 2206 insertions, 0 deletions
diff --git a/libxsd-frontend/tests/dump/driver.cxx b/libxsd-frontend/tests/dump/driver.cxx
new file mode 100644
index 0000000..5217ebf
--- /dev/null
+++ b/libxsd-frontend/tests/dump/driver.cxx
@@ -0,0 +1,734 @@
+// file : tests/dump/driver.cxx
+// author : Boris Kolpackov <boris@codesynthesis.com>
+// copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+// license : GNU GPL v2 + exceptions; see accompanying LICENSE file
+
+#include <cult/types.hxx>
+
+#include <xsd-frontend/parser.hxx>
+#include <xsd-frontend/transformations/anonymous.hxx>
+#include <xsd-frontend/transformations/enum-synthesis.hxx>
+
+#include <xsd-frontend/semantic-graph.hxx>
+#include <xsd-frontend/traversal.hxx>
+
+#include <iostream>
+
+using namespace Cult::Types;
+using namespace XSDFrontend;
+
+using std::wcerr;
+using std::wcout;
+using std::endl;
+
+UnsignedLong indent = 0;
+
+std::wostream&
+ind (std::wostream& os)
+{
+ for (UnsignedLong n (0); n < indent; ++n)
+ os << L" ";
+
+ return os;
+}
+
+namespace
+{
+ typedef Cult::Types::WideString String;
+
+ // 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 ("<anonymous>"));
+
+ 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 ("<anonymous>")) << " ";
+
+ 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 ("<anonymous>")) << ": " <<
+ 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 <recursive-anonymous>" << 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 ("<anonymous>"));
+
+ 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);
+ }
+ */
+
+ Boolean
+ 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 WideString
+ translate (WideString const& /*file*/,
+ WideString const& ns,
+ WideString const& name,
+ WideString 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);
+ Boolean anon (false);
+ Boolean 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], boost::filesystem::native);
+
+ Parser parser (true, false, true);
+ Evptr<SemanticGraph::Schema> 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/libxsd-frontend/tests/dump/makefile b/libxsd-frontend/tests/dump/makefile
new file mode 100644
index 0000000..c51e72e
--- /dev/null
+++ b/libxsd-frontend/tests/dump/makefile
@@ -0,0 +1,56 @@
+# file : tests/dump/makefile
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+# 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/libxsd-frontend/tests/makefile b/libxsd-frontend/tests/makefile
new file mode 100644
index 0000000..6b794d6
--- /dev/null
+++ b/libxsd-frontend/tests/makefile
@@ -0,0 +1,17 @@
+# file : tests/makefile
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+# 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/libxsd-frontend/tests/schema/annotation/makefile b/libxsd-frontend/tests/schema/annotation/makefile
new file mode 100644
index 0000000..97f578b
--- /dev/null
+++ b/libxsd-frontend/tests/schema/annotation/makefile
@@ -0,0 +1,35 @@
+# file : tests/schema/annotation/makefile
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+# 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/libxsd-frontend/tests/schema/annotation/test-000.std b/libxsd-frontend/tests/schema/annotation/test-000.std
new file mode 100644
index 0000000..15f3e89
--- /dev/null
+++ b/libxsd-frontend/tests/schema/annotation/test-000.std
@@ -0,0 +1,67 @@
+<schema documentation>
+primary
+{
+ namespace test
+ {
+ <list type documentation>
+ list list http://www.w3.org/2001/XMLSchema#string
+ <union type documentation>
+ union union http://www.w3.org/2001/XMLSchema#int http://www.w3.org/2001/XMLSchema#string
+ <enumeration type documentation>
+ enumeration enum: http://www.w3.org/2001/XMLSchema#string
+ {
+ <enumerator documentation (male)>
+ enumerator male
+ <enumerator documentation (female)>
+ enumerator female
+ }
+ <complex type documentation>
+ complex type
+ {
+ <local element efoo documentation>
+ element efoo
+ <local element ebar documentation>
+ element ebar
+ <local element ebaz documentation>
+ element ebaz
+ <any documentation>
+ any 'any #0'
+ <local attribute afoo documentation>
+ optional attribute afoo http://www.w3.org/2001/XMLSchema#string
+ <local attribute abar documentation>
+ optional attribute abar
+ {
+ <list type documentation>
+ list <anonymous> http://www.w3.org/2001/XMLSchema#string
+ }
+ <local attribute abaz documentation>
+ optional attribute abaz http://www.w3.org/2001/XMLSchema#string
+ <anyAttribute documentation>
+ any-attribute 'any-attribute #0'
+ [1, 1] sequence
+ {
+ [1, 1] element efoo http://www.w3.org/2001/XMLSchema#string
+ [1, 1] element ebar
+ {
+ complex <anonymous>
+ {
+ <nested local element efoo documentation>
+ element efoo
+ <nested local attribute afoo documentation>
+ 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'
+ }
+ }
+ <global element documentation>
+ element ebaz http://www.w3.org/2001/XMLSchema#string
+ <global attribute documentation>
+ attribute abaz http://www.w3.org/2001/XMLSchema#string
+ }
+}
diff --git a/libxsd-frontend/tests/schema/annotation/test-000.xsd b/libxsd-frontend/tests/schema/annotation/test-000.xsd
new file mode 100644
index 0000000..f768b45
--- /dev/null
+++ b/libxsd-frontend/tests/schema/annotation/test-000.xsd
@@ -0,0 +1,120 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <annotation>
+ <documentation>schema documentation</documentation>
+ </annotation>
+
+ <simpleType name="list">
+ <annotation>
+ <documentation>list type documentation</documentation>
+ </annotation>
+ <list itemType="string"/>
+ </simpleType>
+
+ <simpleType name="union">
+ <annotation>
+ <documentation>union type documentation</documentation>
+ </annotation>
+ <union memberTypes="int string"/>
+ </simpleType>
+
+ <simpleType name="enum">
+ <annotation>
+ <documentation>enumeration type documentation</documentation>
+ </annotation>
+ <restriction base="string">
+ <enumeration value="male">
+ <annotation>
+ <documentation>enumerator documentation (male)</documentation>
+ </annotation>
+ </enumeration>
+ <enumeration value="female">
+ <annotation>
+ <documentation>enumerator documentation (female)</documentation>
+ </annotation>
+ </enumeration>
+ </restriction>
+ </simpleType>
+
+ <complexType name="type">
+ <annotation>
+ <documentation>complex type documentation</documentation>
+ </annotation>
+ <sequence>
+ <element name="efoo" type="string">
+ <annotation>
+ <documentation>local element efoo documentation</documentation>
+ </annotation>
+ </element>
+ <element name="ebar">
+ <annotation>
+ <documentation>local element ebar documentation</documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element name="efoo" type="string">
+ <annotation>
+ <documentation>nested local element efoo documentation</documentation>
+ </annotation>
+ </element>
+ </sequence>
+ <attribute name="afoo" type="string">
+ <annotation>
+ <documentation>nested local attribute afoo documentation</documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+ <element ref="t:ebaz">
+ <annotation>
+ <documentation>local element ebaz documentation</documentation>
+ </annotation>
+ </element>
+ <any namespace="##other">
+ <annotation>
+ <documentation>any documentation</documentation>
+ </annotation>
+ </any>
+ </sequence>
+ <attribute name="afoo" type="string">
+ <annotation>
+ <documentation>local attribute afoo documentation</documentation>
+ </annotation>
+ </attribute>
+ <attribute name="abar">
+ <annotation>
+ <documentation>local attribute abar documentation</documentation>
+ </annotation>
+ <simpleType>
+ <annotation>
+ <documentation>list type documentation</documentation>
+ </annotation>
+ <list itemType="string"/>
+ </simpleType>
+ </attribute>
+ <attribute ref="t:abaz">
+ <annotation>
+ <documentation>local attribute abaz documentation</documentation>
+ </annotation>
+ </attribute>
+ <anyAttribute namespace="##other">
+ <annotation>
+ <documentation>anyAttribute documentation</documentation>
+ </annotation>
+ </anyAttribute>
+ </complexType>
+
+ <element name="ebaz" type="string">
+ <annotation>
+ <documentation>global element documentation</documentation>
+ </annotation>
+ </element>
+
+ <attribute name="abaz" type="string">
+ <annotation>
+ <documentation>global attribute documentation</documentation>
+ </annotation>
+ </attribute>
+
+</schema>
diff --git a/libxsd-frontend/tests/schema/annotation/test-001.std b/libxsd-frontend/tests/schema/annotation/test-001.std
new file mode 100644
index 0000000..9e2c99a
--- /dev/null
+++ b/libxsd-frontend/tests/schema/annotation/test-001.std
@@ -0,0 +1,36 @@
+primary
+{
+ namespace test
+ {
+ complex type
+ {
+ <global element ebar documentation>
+ element ebar
+ <group element efoo documentation>
+ element efoo
+ <global element ebar documentation>
+ element ebar
+ <global attribute abar documentation>
+ optional attribute abar http://www.w3.org/2001/XMLSchema#string
+ <group attribute afoo documentation>
+ optional attribute afoo http://www.w3.org/2001/XMLSchema#string
+ <global attribute abaz documentation>
+ 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
+ }
+ }
+ }
+ <global element ebar documentation>
+ element ebar http://www.w3.org/2001/XMLSchema#string
+ <global attribute abar documentation>
+ attribute abar http://www.w3.org/2001/XMLSchema#string
+ <global attribute abaz documentation>
+ attribute abaz http://www.w3.org/2001/XMLSchema#string
+ }
+}
diff --git a/libxsd-frontend/tests/schema/annotation/test-001.xsd b/libxsd-frontend/tests/schema/annotation/test-001.xsd
new file mode 100644
index 0000000..286f63a
--- /dev/null
+++ b/libxsd-frontend/tests/schema/annotation/test-001.xsd
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <!-- Test various ref constructs. -->
+
+ <complexType name="type">
+ <sequence>
+ <element ref="t:ebar"/>
+ <group ref="t:eg"/>
+ </sequence>
+ <attribute ref="t:abar"/>
+ <attributeGroup ref="t:ag"/>
+ </complexType>
+
+ <group name="eg">
+ <choice>
+ <element name="efoo" type="string">
+ <annotation>
+ <documentation>group element efoo documentation</documentation>
+ </annotation>
+ </element>
+ <element ref="t:ebar"/>
+ </choice>
+ </group>
+
+ <element name="ebar" type="string">
+ <annotation>
+ <documentation>global element ebar documentation</documentation>
+ </annotation>
+ </element>
+
+ <attributeGroup name="ag">
+ <attribute name="afoo" type="string">
+ <annotation>
+ <documentation>group attribute afoo documentation</documentation>
+ </annotation>
+ </attribute>
+ <attribute ref="t:abaz"/>
+ </attributeGroup>
+
+ <attribute name="abar" type="string">
+ <annotation>
+ <documentation>global attribute abar documentation</documentation>
+ </annotation>
+ </attribute>
+
+ <attribute name="abaz" type="string">
+ <annotation>
+ <documentation>global attribute abaz documentation</documentation>
+ </annotation>
+ </attribute>
+
+</schema>
diff --git a/libxsd-frontend/tests/schema/anonymous/makefile b/libxsd-frontend/tests/schema/anonymous/makefile
new file mode 100644
index 0000000..950e34b
--- /dev/null
+++ b/libxsd-frontend/tests/schema/anonymous/makefile
@@ -0,0 +1,35 @@
+# file : tests/schema/annotation/makefile
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+# 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/libxsd-frontend/tests/schema/anonymous/test-000.std b/libxsd-frontend/tests/schema/anonymous/test-000.std
new file mode 100644
index 0000000..1f33cb0
--- /dev/null
+++ b/libxsd-frontend/tests/schema/anonymous/test-000.std
@@ -0,0 +1,30 @@
+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/libxsd-frontend/tests/schema/anonymous/test-000.xsd b/libxsd-frontend/tests/schema/anonymous/test-000.xsd
new file mode 100644
index 0000000..ece8f4a
--- /dev/null
+++ b/libxsd-frontend/tests/schema/anonymous/test-000.xsd
@@ -0,0 +1,42 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <simpleType name="named">
+ <list itemType="string"/>
+ </simpleType>
+
+ <simpleType name="anon_item">
+ <restriction base="string">
+ <enumeration value="male"/>
+ <enumeration value="female"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="anon">
+ <list>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="male"/>
+ <enumeration value="female"/>
+ </restriction>
+ </simpleType>
+ </list>
+ </simpleType>
+
+ <simpleType name="anon_nested">
+ <list>
+ <simpleType>
+ <restriction>
+ <simpleType>
+ <restriction base="string">
+ <maxLength value="20"/>
+ </restriction>
+ </simpleType>
+ <enumeration value="male"/>
+ <enumeration value="female"/>
+ </restriction>
+ </simpleType>
+ </list>
+ </simpleType>
+
+</schema>
diff --git a/libxsd-frontend/tests/schema/anonymous/test-001.std b/libxsd-frontend/tests/schema/anonymous/test-001.std
new file mode 100644
index 0000000..cc3f2d1
--- /dev/null
+++ b/libxsd-frontend/tests/schema/anonymous/test-001.std
@@ -0,0 +1,38 @@
+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/libxsd-frontend/tests/schema/anonymous/test-001.xsd b/libxsd-frontend/tests/schema/anonymous/test-001.xsd
new file mode 100644
index 0000000..4a8414f
--- /dev/null
+++ b/libxsd-frontend/tests/schema/anonymous/test-001.xsd
@@ -0,0 +1,47 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <simpleType name="named">
+ <restriction base="string">
+ <enumeration value="male"/>
+ <enumeration value="female"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="anon_base">
+ <restriction base="string">
+ <enumeration value="male"/>
+ <enumeration value="female"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="anon">
+ <restriction>
+ <simpleType>
+ <restriction base="string">
+ <maxLength value="20"/>
+ </restriction>
+ </simpleType>
+ <enumeration value="male"/>
+ <enumeration value="female"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="anon_nested">
+ <restriction>
+ <simpleType>
+ <restriction>
+ <simpleType>
+ <restriction base="string">
+ <maxLength value="40"/>
+ </restriction>
+ </simpleType>
+ <maxLength value="20"/>
+ </restriction>
+ </simpleType>
+ <enumeration value="male"/>
+ <enumeration value="female"/>
+ </restriction>
+ </simpleType>
+
+</schema>
diff --git a/libxsd-frontend/tests/schema/attribute-group/makefile b/libxsd-frontend/tests/schema/attribute-group/makefile
new file mode 100644
index 0000000..e96c0c7
--- /dev/null
+++ b/libxsd-frontend/tests/schema/attribute-group/makefile
@@ -0,0 +1,35 @@
+# file : tests/schema/attribute-group/makefile
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+# 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/libxsd-frontend/tests/schema/attribute-group/test-000.std b/libxsd-frontend/tests/schema/attribute-group/test-000.std
new file mode 100644
index 0000000..61ad802
--- /dev/null
+++ b/libxsd-frontend/tests/schema/attribute-group/test-000.std
@@ -0,0 +1,17 @@
+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/libxsd-frontend/tests/schema/attribute-group/test-000.xsd b/libxsd-frontend/tests/schema/attribute-group/test-000.xsd
new file mode 100644
index 0000000..9087a2b
--- /dev/null
+++ b/libxsd-frontend/tests/schema/attribute-group/test-000.xsd
@@ -0,0 +1,31 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <!-- Multiple levels of forward reference. -->
+
+ <complexType name="type">
+ <attributeGroup ref="t:g1"/>
+ </complexType>
+
+ <attributeGroup name="g1">
+ <attributeGroup ref="t:g2"/>
+ <attributeGroup ref="t:g3"/>
+ </attributeGroup>
+
+ <attributeGroup name="g2">
+ <attribute ref="t:foo2"/>
+ <attribute ref="t:bar2" use="required"/>
+ </attributeGroup>
+
+ <attributeGroup name="g3">
+ <attribute ref="t:foo3"/>
+ <attribute ref="t:bar3" use="required"/>
+ </attributeGroup>
+
+ <attribute name="foo2" type="string"/>
+ <attribute name="bar2" type="string"/>
+
+ <attribute name="foo3" type="string"/>
+ <attribute name="bar3" type="string"/>
+
+</schema>
diff --git a/libxsd-frontend/tests/schema/attribute-group/test-001.std b/libxsd-frontend/tests/schema/attribute-group/test-001.std
new file mode 100644
index 0000000..54a1e96
--- /dev/null
+++ b/libxsd-frontend/tests/schema/attribute-group/test-001.std
@@ -0,0 +1,12 @@
+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/libxsd-frontend/tests/schema/attribute-group/test-001.xsd b/libxsd-frontend/tests/schema/attribute-group/test-001.xsd
new file mode 100644
index 0000000..dc44a70
--- /dev/null
+++ b/libxsd-frontend/tests/schema/attribute-group/test-001.xsd
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <!-- AnyAttribute in attribute groups. -->
+
+ <complexType name="type">
+ <attributeGroup ref="t:g1"/>
+ <attributeGroup ref="t:g2"/>
+ </complexType>
+
+ <attributeGroup name="g1">
+ <anyAttribute namespace="http://www.foo.com"/>
+ </attributeGroup>
+
+ <attributeGroup name="g2">
+ <attribute name="foo" type="string"/>
+ <anyAttribute namespace="http://www.bar.com"/>
+ </attributeGroup>
+
+</schema>
diff --git a/libxsd-frontend/tests/schema/default/makefile b/libxsd-frontend/tests/schema/default/makefile
new file mode 100644
index 0000000..dbb5fa9
--- /dev/null
+++ b/libxsd-frontend/tests/schema/default/makefile
@@ -0,0 +1,35 @@
+# file : tests/schema/default/makefile
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+# 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/libxsd-frontend/tests/schema/default/test-000.std b/libxsd-frontend/tests/schema/default/test-000.std
new file mode 100644
index 0000000..efa1140
--- /dev/null
+++ b/libxsd-frontend/tests/schema/default/test-000.std
@@ -0,0 +1,28 @@
+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/libxsd-frontend/tests/schema/default/test-000.xsd b/libxsd-frontend/tests/schema/default/test-000.xsd
new file mode 100644
index 0000000..bfaedc5
--- /dev/null
+++ b/libxsd-frontend/tests/schema/default/test-000.xsd
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="test" xmlns:x="foo" targetNamespace="test">
+
+ <xs:complexType name="type">
+ <xs:sequence>
+ <xs:element name="e1" type="xs:int" default="123"/>
+ <xs:element name="e2" type="xs:int" fixed="456"/>
+
+ <xs:element name="e3" type="xs:QName" default="unqual"/>
+ <xs:element name="e4" type="xs:QName" fixed="t:foo"/>
+ <xs:element name="e5" type="xs:QName" default="x:bar"/>
+ </xs:sequence>
+ <xs:attribute name="a1" type="xs:int" default="123"/>
+ <xs:attribute name="a2" type="xs:int" fixed="456"/>
+
+ <xs:attribute name="a3" type="t:qname" default="x:bar"/>
+ </xs:complexType>
+
+ <xs:simpleType name="qname">
+ <xs:restriction base="xs:QName"/>
+ </xs:simpleType>
+
+</xs:schema>
diff --git a/libxsd-frontend/tests/schema/default/test-001.std b/libxsd-frontend/tests/schema/default/test-001.std
new file mode 100644
index 0000000..1b84a07
--- /dev/null
+++ b/libxsd-frontend/tests/schema/default/test-001.std
@@ -0,0 +1,15 @@
+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/libxsd-frontend/tests/schema/default/test-001.xsd b/libxsd-frontend/tests/schema/default/test-001.xsd
new file mode 100644
index 0000000..5ee0507
--- /dev/null
+++ b/libxsd-frontend/tests/schema/default/test-001.xsd
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:t="test" xmlns="foo" targetNamespace="test">
+
+ <xs:complexType name="type">
+ <xs:sequence>
+ <xs:element name="e" type="xs:QName" default="unqual"/>
+ </xs:sequence>
+ <xs:attribute name="a" type="xs:QName" default="unqual"/>
+ </xs:complexType>
+
+</xs:schema>
diff --git a/libxsd-frontend/tests/schema/element-group/makefile b/libxsd-frontend/tests/schema/element-group/makefile
new file mode 100644
index 0000000..8a4ad89
--- /dev/null
+++ b/libxsd-frontend/tests/schema/element-group/makefile
@@ -0,0 +1,35 @@
+# file : tests/schema/element-group/makefile
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+# 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/libxsd-frontend/tests/schema/element-group/test-000.std b/libxsd-frontend/tests/schema/element-group/test-000.std
new file mode 100644
index 0000000..1652b68
--- /dev/null
+++ b/libxsd-frontend/tests/schema/element-group/test-000.std
@@ -0,0 +1,33 @@
+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/libxsd-frontend/tests/schema/element-group/test-000.xsd b/libxsd-frontend/tests/schema/element-group/test-000.xsd
new file mode 100644
index 0000000..1864b28
--- /dev/null
+++ b/libxsd-frontend/tests/schema/element-group/test-000.xsd
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <!-- Multiple levels of forward reference. -->
+
+ <complexType name="type">
+ <sequence>
+ <group ref="t:g1" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <group name="g1">
+ <choice>
+ <group ref="t:g2" minOccurs="0"/>
+ <group ref="t:g3" maxOccurs="unbounded"/>
+ </choice>
+ </group>
+
+ <group name="g2">
+ <choice>
+ <element ref="t:foo2"/>
+ <element ref="t:bar2" minOccurs="0"/>
+ </choice>
+ </group>
+
+ <group name="g3">
+ <choice>
+ <element ref="t:foo3" maxOccurs="unbounded"/>
+ <element ref="t:bar3" minOccurs="0" maxOccurs="unbounded"/>
+ </choice>
+ </group>
+
+ <element name="foo2" type="string"/>
+ <element name="bar2" type="string"/>
+
+ <element name="foo3" type="string"/>
+ <element name="bar3" type="string"/>
+
+</schema>
diff --git a/libxsd-frontend/tests/schema/element-group/test-001.std b/libxsd-frontend/tests/schema/element-group/test-001.std
new file mode 100644
index 0000000..ae8c1fc
--- /dev/null
+++ b/libxsd-frontend/tests/schema/element-group/test-001.std
@@ -0,0 +1,137 @@
+primary
+{
+ namespace test
+ {
+ complex type
+ {
+ element foo
+ element bar
+ [1, 1] sequence
+ {
+ [1, 1] choice
+ {
+ [1, 1] element foo
+ {
+ complex <anonymous>
+ {
+ element foo
+ element bar
+ [1, 1] sequence
+ {
+ [1, 1] choice
+ {
+ [1, 1] element foo
+ {
+ complex <recursive-anonymous>
+ }
+ [1, 1] element bar
+ {
+ complex <anonymous>
+ {
+ element foo
+ element bar
+ [1, 1] sequence
+ {
+ [1, 1] choice
+ {
+ [1, 1] element foo
+ {
+ complex <recursive-anonymous>
+ }
+ [1, 1] element bar
+ {
+ complex <recursive-anonymous>
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ [1, 1] element bar
+ {
+ complex <anonymous>
+ {
+ element foo
+ element bar
+ [1, 1] sequence
+ {
+ [1, 1] choice
+ {
+ [1, 1] element foo
+ {
+ complex <anonymous>
+ {
+ element foo
+ element bar
+ [1, 1] sequence
+ {
+ [1, 1] choice
+ {
+ [1, 1] element foo
+ {
+ complex <recursive-anonymous>
+ }
+ [1, 1] element bar
+ {
+ complex <recursive-anonymous>
+ }
+ }
+ }
+ }
+ }
+ [1, 1] element bar
+ {
+ complex <recursive-anonymous>
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ element bar
+ {
+ complex <anonymous>
+ {
+ element foo
+ element bar
+ [1, 1] sequence
+ {
+ [1, 1] choice
+ {
+ [1, 1] element foo
+ {
+ complex <anonymous>
+ {
+ element foo
+ element bar
+ [1, 1] sequence
+ {
+ [1, 1] choice
+ {
+ [1, 1] element foo
+ {
+ complex <recursive-anonymous>
+ }
+ [1, 1] element bar
+ {
+ complex <recursive-anonymous>
+ }
+ }
+ }
+ }
+ }
+ [1, 1] element bar
+ {
+ complex <recursive-anonymous>
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/libxsd-frontend/tests/schema/element-group/test-001.xsd b/libxsd-frontend/tests/schema/element-group/test-001.xsd
new file mode 100644
index 0000000..c6059af
--- /dev/null
+++ b/libxsd-frontend/tests/schema/element-group/test-001.xsd
@@ -0,0 +1,33 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <!-- Recursive reference: g1->element->type->g1 -->
+
+ <complexType name="type">
+ <sequence>
+ <group ref="t:g1"/>
+ </sequence>
+ </complexType>
+
+ <group name="g1">
+ <choice>
+ <element name="foo">
+ <complexType>
+ <sequence>
+ <group ref="t:g1"/>
+ </sequence>
+ </complexType>
+ </element>
+ <element ref="t:bar"/>
+ </choice>
+ </group>
+
+ <element name="bar">
+ <complexType>
+ <sequence>
+ <group ref="t:g1"/>
+ </sequence>
+ </complexType>
+ </element>
+
+</schema>
diff --git a/libxsd-frontend/tests/schema/element-group/test-002.std b/libxsd-frontend/tests/schema/element-group/test-002.std
new file mode 100644
index 0000000..d2c60fe
--- /dev/null
+++ b/libxsd-frontend/tests/schema/element-group/test-002.std
@@ -0,0 +1,24 @@
+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/libxsd-frontend/tests/schema/element-group/test-002.xsd b/libxsd-frontend/tests/schema/element-group/test-002.xsd
new file mode 100644
index 0000000..bc1bd70
--- /dev/null
+++ b/libxsd-frontend/tests/schema/element-group/test-002.xsd
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <!-- Any in groups. -->
+
+ <complexType name="type">
+ <sequence>
+ <group ref="t:g1" minOccurs="0" maxOccurs="unbounded"/>
+ <group ref="t:g2" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+
+ <group name="g1">
+ <sequence>
+ <any namespace="http://www.foo.com"/>
+ </sequence>
+ </group>
+
+ <group name="g2">
+ <sequence>
+ <element name="foo" type="int"/>
+ <any namespace="http://www.bar.com"/>
+ </sequence>
+ </group>
+
+</schema>
diff --git a/libxsd-frontend/tests/schema/enumeration/makefile b/libxsd-frontend/tests/schema/enumeration/makefile
new file mode 100644
index 0000000..d958178
--- /dev/null
+++ b/libxsd-frontend/tests/schema/enumeration/makefile
@@ -0,0 +1,35 @@
+# file : tests/schema/enumeration/makefile
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+# 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/libxsd-frontend/tests/schema/enumeration/test-000.std b/libxsd-frontend/tests/schema/enumeration/test-000.std
new file mode 100644
index 0000000..64e3065
--- /dev/null
+++ b/libxsd-frontend/tests/schema/enumeration/test-000.std
@@ -0,0 +1,62 @@
+primary
+{
+ namespace test
+ {
+ complex common-base: http://www.w3.org/2001/XMLSchema#string
+ {
+ }
+ complex base: test#common-base
+ {
+ }
+ enumeration one: test#base
+ {
+ <romance documentation>
+ 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
+ {
+ <romance documentation>
+ enumerator romance
+ enumerator fiction
+ enumerator horror
+ enumerator history
+ enumerator philosophy
+ }
+ <union1 documentation>
+ enumeration union1: test#common-base
+ {
+ <romance documentation>
+ 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/libxsd-frontend/tests/schema/enumeration/test-000.xsd b/libxsd-frontend/tests/schema/enumeration/test-000.xsd
new file mode 100644
index 0000000..08539bf
--- /dev/null
+++ b/libxsd-frontend/tests/schema/enumeration/test-000.xsd
@@ -0,0 +1,72 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <!-- Enumeration synthesis -->
+
+ <simpleType name="common-base">
+ <restriction base="string"/>
+ </simpleType>
+
+ <simpleType name="base">
+ <restriction base="t:common-base"/>
+ </simpleType>
+
+ <simpleType name="one">
+ <restriction base="t:base">
+ <enumeration value="romance">
+ <annotation>
+ <documentation>romance documentation</documentation>
+ </annotation>
+ </enumeration>
+ <enumeration value="fiction"/>
+ <enumeration value="horror"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="two">
+ <restriction base="t:common-base">
+ <enumeration value="horror"/>
+ <enumeration value="history"/>
+ <enumeration value="philosophy"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="three">
+ <restriction base="anyURI">
+ <enumeration value="foo"/>
+ <enumeration value="bar"/>
+ </restriction>
+ </simpleType>
+
+ <simpleType name="union0">
+ <union memberTypes="t:one t:two t:union1"/>
+ </simpleType>
+
+ <simpleType name="union1">
+ <annotation>
+ <documentation>union1 documentation</documentation>
+ </annotation>
+ <union memberTypes="t:one t:two"/>
+ </simpleType>
+
+ <simpleType name="union2">
+ <union memberTypes="t:one t:union1 t:common-base"/>
+ </simpleType>
+
+ <simpleType name="union3">
+ <union memberTypes="t:one t:three"/>
+ </simpleType>
+
+ <complexType name="complex1">
+ <sequence>
+ <element name="a" type="t:union1"/>
+ </sequence>
+ </complexType>
+
+ <complexType name="complex2">
+ <simpleContent>
+ <extension base="t:union1"/>
+ </simpleContent>
+ </complexType>
+
+</schema>
diff --git a/libxsd-frontend/tests/schema/makefile b/libxsd-frontend/tests/schema/makefile
new file mode 100644
index 0000000..fde5482
--- /dev/null
+++ b/libxsd-frontend/tests/schema/makefile
@@ -0,0 +1,25 @@
+# file : tests/schema
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+# 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/libxsd-frontend/tests/schema/union/makefile b/libxsd-frontend/tests/schema/union/makefile
new file mode 100644
index 0000000..7f01070
--- /dev/null
+++ b/libxsd-frontend/tests/schema/union/makefile
@@ -0,0 +1,35 @@
+# file : tests/schema/union/makefile
+# author : Boris Kolpackov <boris@codesynthesis.com>
+# copyright : Copyright (c) 2006-2010 Code Synthesis Tools CC
+# 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/libxsd-frontend/tests/schema/union/test-000.std b/libxsd-frontend/tests/schema/union/test-000.std
new file mode 100644
index 0000000..6f95b0c
--- /dev/null
+++ b/libxsd-frontend/tests/schema/union/test-000.std
@@ -0,0 +1,37 @@
+primary
+{
+ namespace test
+ {
+ union u1 http://www.w3.org/2001/XMLSchema#int http://www.w3.org/2001/XMLSchema#string
+ union u2
+ {
+ enumeration <anonymous>: http://www.w3.org/2001/XMLSchema#token
+ {
+ enumerator one
+ }
+ }
+
+ {
+ enumeration <anonymous>: http://www.w3.org/2001/XMLSchema#string
+ {
+ enumerator two
+ }
+ }
+
+ union u3 http://www.w3.org/2001/XMLSchema#int test#u1
+ {
+ enumeration <anonymous>: http://www.w3.org/2001/XMLSchema#token
+ {
+ enumerator one
+ }
+ }
+
+ {
+ enumeration <anonymous>: http://www.w3.org/2001/XMLSchema#string
+ {
+ enumerator two
+ }
+ }
+
+ }
+}
diff --git a/libxsd-frontend/tests/schema/union/test-000.xsd b/libxsd-frontend/tests/schema/union/test-000.xsd
new file mode 100644
index 0000000..99535de
--- /dev/null
+++ b/libxsd-frontend/tests/schema/union/test-000.xsd
@@ -0,0 +1,40 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <simpleType name="u1">
+ <union memberTypes="int string"/>
+ </simpleType>
+
+ <simpleType name="u2">
+ <union>
+ <simpleType>
+ <restriction base="token">
+ <enumeration value="one"/>
+ </restriction>
+ </simpleType>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="two"/>
+ </restriction>
+ </simpleType>
+ </union>
+ </simpleType>
+
+ <simpleType name="u3">
+ <union memberTypes=" int
+
+t:u1 ">
+ <simpleType>
+ <restriction base="token">
+ <enumeration value="one"/>
+ </restriction>
+ </simpleType>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="two"/>
+ </restriction>
+ </simpleType>
+ </union>
+ </simpleType>
+
+</schema>
diff --git a/libxsd-frontend/tests/schema/union/test-001.std b/libxsd-frontend/tests/schema/union/test-001.std
new file mode 100644
index 0000000..f407b30
--- /dev/null
+++ b/libxsd-frontend/tests/schema/union/test-001.std
@@ -0,0 +1,15 @@
+primary
+{
+ namespace test
+ {
+ list list
+ {
+ union <anonymous> 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/libxsd-frontend/tests/schema/union/test-001.xsd b/libxsd-frontend/tests/schema/union/test-001.xsd
new file mode 100644
index 0000000..00fd8ce
--- /dev/null
+++ b/libxsd-frontend/tests/schema/union/test-001.xsd
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test">
+
+ <!-- Test resolution of anonymous argument types. -->
+
+ <simpleType name="list">
+ <list>
+ <simpleType>
+ <union memberTypes="int t:enum"/>
+ </simpleType>
+ </list>
+ </simpleType>
+
+ <simpleType name="enum">
+ <restriction base="string">
+ <enumeration value="male"/>
+ <enumeration value="female"/>
+ </restriction>
+ </simpleType>
+
+</schema>