File: 014Constructors.t

package info (click to toggle)
libnet-amazon-perl 0.35-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 908 kB
  • ctags: 160
  • sloc: xml: 4,821; perl: 2,055; makefile: 46
file content (38 lines) | stat: -rw-r--r-- 768 bytes parent folder | download
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
36
37
38
#########################
# Test all constructors
#########################

use warnings;
use strict;

use Test::More tests => 13;
BEGIN { use_ok('Net::Amazon') };

my @request_types = (
['Artist'],
['ASIN'],
['Blended'],
['BrowseNode', 'mode'],
['Keyword', 'mode'],
['Manufacturer'],
['Power', 'mode'],
['Seller'],
['Similar'],
['TextStream'],
['UPC'],
['Wishlist'],
);

for my $t (@request_types) {
    my $class  = $t->[0];
    my $tlower = lc($t->[0]);
    my $params = join(', ', map { "$_ => '234'" }
                     ($tlower, @$t > 1 ? $t->[1] : ()));

    #print "$class $params\n";
    my $use = "use Net::Amazon::Request::$class";
    my $new = "Net::Amazon::Request::$class->new($params)";
    ok(eval "$use; $new", 
       "$new");
print $@ if $@;
}