1use strict;
2use warnings;
3use Test::Base;
4use Text::Diff3 qw(:factory);
5
6plan tests => 1 * blocks;
7
8# If you test another Factory or Diff2Processor change this
9my $Factory = 'Text::Diff3::Factory';
10
11my $f = $Factory->new;
12my $p2 = $f->create_diff;
13
14sub testdiff {
15    my($try) = @_;
16    return [$p2->diff(map { $f->create_text($_) } eval $try)->as_array];
17}
18
19filters {
20    input => [qw(testdiff)],
21    expected => [qw(eval)],
22};
23
24run_is_deeply 'input' => 'expected';
25
26__END__
27
28=== 2,2c2,2; 4,3a4,5; 5,7d7,6
29--- input
30[qw(a b c     f g h i j)],
31[qw(a B c d e f       j)],
32--- expected
33[[qw(c 2 2 2 2)], [qw(a 4 3 4 5)], [qw(d 5 7 7 6)]]
34
35=== 1,0a1,1
36--- input
37[qw(a b c )],
38[qw(A a b c)],
39--- expected
40[[qw(a 1 0 1 1)]]
41
42=== 4,3a4,4
43--- input
44[qw(a b c)],
45[qw(a b c D)],
46--- expected
47[[qw(a 4 3 4 4)]]
48
49=== 1,1d1,0
50--- input
51[qw(A b c)],
52[qw(b c)],
53--- expected
54[[qw(d 1 1 1 0)]]
55
56=== 2,2d2,1
57--- input
58[qw(a B c)],
59[qw(a c)],
60--- expected
61[[qw(d 2 2 2 1)]]
62
63=== 3,3d3,2
64--- input
65[qw(a b C)],
66[qw(a b)],
67--- expected
68[[qw(d 3 3 3 2)]]
69
70