aboutsummaryrefslogtreecommitdiff
path: root/tests/schema/union.testscript
diff options
context:
space:
mode:
Diffstat (limited to 'tests/schema/union.testscript')
-rw-r--r--tests/schema/union.testscript135
1 files changed, 135 insertions, 0 deletions
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 <<EOI >=test.xsd;
+ <?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>
+ 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 <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
+ }
+ }
+
+ }
+ }
+ EOO
+}
+
+: anonymous
+:
+{
+ cat <<EOI >=test.xsd;
+ <?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>
+ EOI
+
+ $* test.xsd >>EOO
+ 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
+ }
+ }
+ }
+ EOO
+}