diff options
Diffstat (limited to 'xsd-tests/cxx/tree/types-only')
-rw-r--r-- | xsd-tests/cxx/tree/types-only/buildfile | 20 | ||||
-rw-r--r-- | xsd-tests/cxx/tree/types-only/driver.cxx | 30 | ||||
-rw-r--r-- | xsd-tests/cxx/tree/types-only/test.xsd | 52 |
3 files changed, 102 insertions, 0 deletions
diff --git a/xsd-tests/cxx/tree/types-only/buildfile b/xsd-tests/cxx/tree/types-only/buildfile new file mode 100644 index 0000000..fa02277 --- /dev/null +++ b/xsd-tests/cxx/tree/types-only/buildfile @@ -0,0 +1,20 @@ +# file : cxx/tree/types-only/buildfile +# license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +import libs = libxsd%lib{xsd} +import libs += libxerces-c%lib{xerces-c} + +exe{driver}: {hxx cxx}{* -test} {hxx ixx cxx}{test} $libs + +<{hxx ixx cxx}{test}>: xsd{test} $xsd +{{ + diag xsd ($<[0]) # @@ TMP + + $xsd cxx-tree --std c++11 \ + --generate-inline \ + --suppress-parsing \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/types-only/driver.cxx b/xsd-tests/cxx/tree/types-only/driver.cxx new file mode 100644 index 0000000..730b807 --- /dev/null +++ b/xsd-tests/cxx/tree/types-only/driver.cxx @@ -0,0 +1,30 @@ +// file : cxx/tree/types-only/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test that code generated without parsing and serialization functions +// still compiles. +// + +#include <iostream> + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main () +{ + color_enum red (color_enum::red); + red_blue_enum blue (red_blue_enum::blue); + + long_string_union num ("123"); + + string_list list; + list.push_back ("Hello"); + list.push_back ("World"); + + complex_type t ("Hello, World!", "foo", color_enum::red); + + anon a ("Hello, World!"); +} diff --git a/xsd-tests/cxx/tree/types-only/test.xsd b/xsd-tests/cxx/tree/types-only/test.xsd new file mode 100644 index 0000000..9f02240 --- /dev/null +++ b/xsd-tests/cxx/tree/types-only/test.xsd @@ -0,0 +1,52 @@ +<?xml version="1.0"?> +<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test"> + + <simpleType name="color-enum"> + <restriction base="token"> + <enumeration value="red"/> + <enumeration value="green"/> + <enumeration value="blue"/> + </restriction> + </simpleType> + + <simpleType name="red-blue-enum"> + <restriction base="t:color-enum"> + <enumeration value="red"/> + <enumeration value="blue"/> + </restriction> + </simpleType> + + <simpleType name="long-string-union"> + <union memberTypes="long string"/> + </simpleType> + + <simpleType name="string-list"> + <list itemType="string"/> + </simpleType> + + <complexType name="complex-type"> + <sequence> + <element name="a" type="string"/> + </sequence> + <attribute name="text" type="string" use="required"/> + <attribute name="color" type="t:color-enum" use="required"/> + <attribute name="ftext" type="string" fixed="foo"/> + <attribute name="dcolor" type="t:color-enum" default="red"/> + </complexType> + + <!-- Test that we do not perform type/element name conflict resolution + as well as print any warnings. --> + <element name="type" type="string"/> + + <!-- Test that we generate anonymous type for global element. --> + <element name="anon"> + <complexType> + <sequence> + <element name="a" type="string"/> + </sequence> + </complexType> + </element> + + <element name="root" type="t:complex-type"/> + +</schema> |