"Fossies" - the Fresh Open Source Software Archive

Member "libspf2-1.2.10/perl/t/12_parser.t" (28 Jan 2012, 813 Bytes) of package /linux/privat/libspf2-1.2.10.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 use strict;
    2 use warnings;
    3 use blib;
    4 use Test::More tests => 13;
    5 
    6 use_ok('Mail::SPF_XS');
    7 
    8 my $srv = new Mail::SPF_XS::Server({ debug => 0 });
    9 
   10 my %records = (
   11 	# This is illegal, and will re-stringify to a%%b%%c%%
   12 	# 'a%%b%%c%'		=> 'a%b%c%',
   13 
   14 	'a%%b%%c%%'		=> 'a%b%c%',
   15 	'%%'			=> '%',
   16 	'foo'	=> 'foo',
   17 );
   18 
   19 for (keys %records) {
   20 	my $exp = $srv->expand($_);
   21 	is($exp, $records{$_}, "Expanded $_ as a macro");
   22 
   23 	my $rec = $srv->compile("v=spf1 macro=$_");
   24 
   25 	my $str = $rec->string;
   26 	ok(1, "Compiled v=spf1 macro=$_ as a record");
   27 	is($str, "v=spf1 macro=$_", "Stringified the record");
   28 
   29 	my $value = $rec->modifier('macro');
   30 	is($value, $records{$_}, "Expanded $_ as a modifier");
   31 
   32 #	$rec = $srv->compile("v=spf1 macro=$_ -all");
   33 #	$value = $rec->modifier('macro');
   34 #	is($value, $records{$_}, "Parsed $_ -all");
   35 }