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