File: example.t

package info (click to toggle)
libtest-differences-perl 0.61-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 144 kB
  • sloc: perl: 300; makefile: 2
file content (41 lines) | stat: -rw-r--r-- 956 bytes parent folder | download | duplicates (4)
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
use strict;
my $x;

my $demo = $ENV{DEMO};

eval <<'PRELOAD' ? eval <<'TEST' : ( $x = $@, eval <<'FALLBACK' );
    use Test::More;
    1;
PRELOAD
    use Test::Differences;

    plan tests => 3 ;

    print "#\n# This test misuses TODO:",
          " these TODOs are actually real tests.\n#\n"
        unless $demo;
    TODO: {
        local $TODO = "testing failure, not really a TODO" unless $demo;
        my @docs = (
            join( "", map "this is line $_\n", qw( 1 2 3 ) ),
            join( "", map "this is line $_\n", qw( 1 b 3 ) )
        );
        eq_or_diff @docs, "differences in text";

        @docs = ( ( "        indented\n" x 3 ) x 2 );

        $docs[1] =~ s/(^..*?^)\s+/$1\t/ms or die "Can't subst \\t for ' '";

        eq_or_diff @docs, "differences in whitespace";

        eq_or_diff( Test::Builder->new, [ "Dry, humorless message" ] );
    }
TEST
    use Test;

    plan tests => 1;

    skip $x, "" ;
FALLBACK

die $@ if $@;