diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-12-18 18:48:46 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2021-02-25 13:45:48 +0300 |
commit | 5e527213a2430bb3018e5eebd909aef294edf9b5 (patch) | |
tree | 94de33c82080b53d9a9e300170f6d221d89078f4 /xsd-tests/cxx/tree/union | |
parent | 7420f85ea19b0562ffdd8123442f32bc8bac1267 (diff) |
Switch to build2
Diffstat (limited to 'xsd-tests/cxx/tree/union')
-rw-r--r-- | xsd-tests/cxx/tree/union/ctor/buildfile | 22 | ||||
-rw-r--r-- | xsd-tests/cxx/tree/union/ctor/driver.cxx | 30 | ||||
-rw-r--r-- | xsd-tests/cxx/tree/union/ctor/test.xsd | 14 |
3 files changed, 66 insertions, 0 deletions
diff --git a/xsd-tests/cxx/tree/union/ctor/buildfile b/xsd-tests/cxx/tree/union/ctor/buildfile new file mode 100644 index 0000000..6715cb6 --- /dev/null +++ b/xsd-tests/cxx/tree/union/ctor/buildfile @@ -0,0 +1,22 @@ +# file : cxx/tree/union/ctor/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 \ + --generate-default-ctor \ + --generate-from-base-ctor \ + --generate-doxygen \ + --output-dir $out_base \ + $path($<[0]) +}} + +cxx.poptions =+ "-I$out_base" diff --git a/xsd-tests/cxx/tree/union/ctor/driver.cxx b/xsd-tests/cxx/tree/union/ctor/driver.cxx new file mode 100644 index 0000000..246eea8 --- /dev/null +++ b/xsd-tests/cxx/tree/union/ctor/driver.cxx @@ -0,0 +1,30 @@ +// file : cxx/tree/union/ctor/driver.cxx +// license : GNU GPL v2 + exceptions; see accompanying LICENSE file + +// Test union constructors. +// +#include <string> + +#include "test.hxx" + +using namespace std; +using namespace test; + +int +main () +{ + // Test ctor(const std::string&) + // + { + string const s ("123"); + int_string_union u (s); + type t (s); + } + + // Test ctor(const char*). + // + { + int_string_union u ("123"); + type t ("123"); + } +} diff --git a/xsd-tests/cxx/tree/union/ctor/test.xsd b/xsd-tests/cxx/tree/union/ctor/test.xsd new file mode 100644 index 0000000..9601093 --- /dev/null +++ b/xsd-tests/cxx/tree/union/ctor/test.xsd @@ -0,0 +1,14 @@ +<?xml version="1.0"?> +<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:t="test" targetNamespace="test"> + + <simpleType name="int-string-union"> + <union memberTypes="int string"/> + </simpleType> + + <complexType name="type"> + <sequence> + <element name="a" type="t:int-string-union"/> + </sequence> + </complexType> + +</schema> |