File: TidyTestUtils.pm

package info (click to toggle)
libhtml-tidy5-perl 1.06-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 368 kB
  • sloc: perl: 1,853; makefile: 14
file content (35 lines) | stat: -rw-r--r-- 594 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
package TidyTestUtils;

use 5.010001;
use warnings;
use strict;

use Test::More;

use base 'Exporter';

our @EXPORT_OK = qw(
    remove_specificity
    messages_are
);
our @EXPORT = @EXPORT_OK;

sub remove_specificity {
    my $clean = shift;

    $clean =~ s/HTML Tidy for HTML5 (for .+ )?\bversion \d+\.\d+\.\d+/TIDY/;

    return $clean;
}

sub messages_are {
    local $Test::Builder::Level = $Test::Builder::Level + 1;

    my $tidy     = shift;
    my $expected = shift;
    my $msg      = shift;

    return is_deeply( [ map { $_->as_string } $tidy->messages ], $expected, $msg );
}

1;