File: regression.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 (26 lines) | stat: -rw-r--r-- 560 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
#!/usr/bin/perl -w

use strict;

use Test::More;
use Test::Differences;

my %cases = (
    'AoH with non-scalar values' => {
        got      => [ { a => 1 }, { b => 1, c => [] } ],
        expected => [ { a => 1 }, { b => 1, c => [] } ]
    },
    'Numbers and strings' => {
        got      => { order_id => 127   },
        expected => { order_id => '127' },
    },
);

my @tests;
while ( my ( $name, $test ) = each %cases ) {
    push @tests => sub { eq_or_diff $test->{got}, $test->{expected}, $name };
}

plan tests => scalar @tests;

$_->() for @tests;