File: SimpleType.t

package info (click to toggle)
libsoap-wsdl-perl 3.004-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,600 kB
  • sloc: perl: 8,433; xml: 1,769; java: 19; makefile: 15
file content (35 lines) | stat: -rw-r--r-- 1,125 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
use strict;
use warnings;
use Test::More tests => 12;

use_ok qw(SOAP::WSDL::XSD::SimpleType);

my $obj = SOAP::WSDL::XSD::SimpleType->new();

$obj->set_list({ LocalName => 'foo', Value => 'bar'},
    { LocalName => 'itemType', Value => 'xsd:int'} );
is $obj->get_flavor(), 'list';
is $obj->get_itemType(), 'xsd:int';

is $obj->serialize('Foo', ['Foo', 'Bar']), '<Foo>Foo Bar</Foo>';

$obj->set_union({ LocalName => 'foo', Value => 'bar'},
    { LocalName => 'memberTypes', Value => 'xsd:int'} );
is $obj->get_flavor(), 'union';
is $obj->get_base()->[0], 'xsd:int';

$obj->set_union({ LocalName => 'foo', Value => 'bar'},
    { LocalName => 'memberTypes', Value => 'xsd:int xsd:string'} );
is $obj->get_flavor(), 'union';
is $obj->get_base()->[1], 'xsd:string';

is $obj->serialize('Foo', 'Foobar'), '<Foo>Foobar</Foo>';

$obj->set_flavor('enumeration');
is $obj->serialize('Foo', 'Foobar'), '<Foo>Foobar</Foo>';

# TODO die on non-serializable content...
$obj->set_flavor('');
is $obj->serialize('Foo', 'Foobar'), '';

ok eval { $obj->set_restriction({ LocalName => 'bar'}, { LocalName => 'base', Value => 'string' }); 1; };