1#!/usr/bin/perl -w
2use Test::More tests => 11;
3BEGIN {use_ok('Pod::WSDL::Return')}
4use strict;
5use warnings;
6
7eval {
8	my $a1 = new Pod::WSDL::Return();
9};
10
11ok(defined $@, 'new dies, if it does not get a string');
12
13eval {
14	my $a1 = new Pod::WSDL::Return('$string blah blah ...');
15};
16
17ok(defined $@, 'new dies, if it does not get a string beginning with _RETURN');
18
19eval {
20	my $a1 = new Pod::WSDL::Return('_RETURN string blah blah ...');
21};
22
23ok(defined $@, 'new dies, if array/scalar type is not specified');
24
25my $a1 = new Pod::WSDL::Return('_RETURN $string blah blah ...');
26
27ok($a1->type eq 'string', 'Read type correctly from input');
28ok($a1->array == 0, 'Read scalar type correctly from input');
29ok($a1->descr eq 'blah blah ...', 'Read descr correctly from input');
30
31$a1 = new Pod::WSDL::Return('   _RETURN $string blah blah ...');
32ok($a1->type eq 'string', 'Handles whitespace before _RETURN correctly.');
33
34$a1 = new Pod::WSDL::Return('_RETURN @string blah blah ...');
35ok($a1->array == 1, 'Read array type correctly from input');
36
37$a1 = new Pod::WSDL::Return('_RETURN @string');
38ok($a1->descr eq '', 'No description is handled correctly');
39
40eval {
41	$a1->type('foo');
42};
43
44{
45	no warnings;
46	ok($@ == undef, 'Renaming return type is forbidden.');
47}
48