This shows you the differences between two versions of the page.
— |
kurs:extractemailtld.t [2014/09/10 21:22] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | <code> | ||
+ | use XML::Simple; | ||
+ | use Data::Dumper; | ||
+ | my $data; | ||
+ | my $test_count; | ||
+ | BEGIN { | ||
+ | $data = XMLin("t/testdata.xml"); | ||
+ | $test_count = scalar @{ $data->{e} }; | ||
+ | }; | ||
+ | |||
+ | use Test::More tests => 2 + $test_count; | ||
+ | use ExtractMailTLD; | ||
+ | |||
+ | use_ok('ExtractMailTLD'); | ||
+ | is(ExtractMailTLD::get_tld('bla@blu.at'), 'at', | ||
+ | 'Habe at bekommen'); | ||
+ | |||
+ | print Dumper $data; | ||
+ | |||
+ | foreach my $test (@{$data->{e}}) { | ||
+ | is(ExtractMailTLD::get_tld($test->{m}), $test->{t}, | ||
+ | sprintf("tld von [%s] ist [%s]", | ||
+ | $test->{m}, $test->{t}) | ||
+ | ); | ||
+ | } | ||
+ | |||
+ | ##printf "zahl der tests %s\n", scalar @{$data->{e}}; | ||
+ | </code> |