File: 03-parser-bogus.t

package info (click to toggle)
libmail-authenticationresults-perl 2.20230112-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 364 kB
  • sloc: perl: 2,803; makefile: 2
file content (44 lines) | stat: -rw-r--r-- 1,072 bytes parent folder | download | duplicates (3)
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
39
40
41
42
43
44
#!perl
use 5.008;
use strict;
use warnings FATAL => 'all';
use lib 't';
use Test::More;
use Test::Exception;

use lib 'lib';
use Mail::AuthenticationResults::Parser;

my $Parsed;

my @GoodStrings = (
    'test.example.com foo;',
    'test.example.com foo ',
    'test.example.com; foo = ',
);

my @BadStrings = (
    'test.example.com = = test;',
    'test.example.com foo = = bar;',
    'test.example.com . bar = test;',
    'test.example.com foo . bar = test;',
    'test.example.com foo / bar = test;',
    'test.example.com foo bar = test;',
    'test.example.com; foo = = bar;',
    'test.example.com; foo / bar = test;',
    'test.example.com; foo . . bar = test;',
    'test.example.com; foo / . bar = test;',
    'test.example.com; foo . / bar = test;',

);

foreach my $String ( @GoodStrings ) {
    lives_ok( sub{ $Parsed = Mail::AuthenticationResults::Parser->new()->parse( $String ) }, $String );
}

foreach my $String ( @BadStrings ) {
    dies_ok( sub{ $Parsed = Mail::AuthenticationResults::Parser->new()->parse( $String ) }, $String );
}

done_testing();