User Tools

Site Tools


kurs:extractemailtld.t

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

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>​
kurs/extractemailtld.t.txt ยท Last modified: 2014/09/10 21:22 (external edit)