diff options
Diffstat (limited to 'libxsd-frontend/tests/schema/element-group')
7 files changed, 327 insertions, 0 deletions
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> |