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