Split from git://repo.or.cz/quvi.git
[libquvi-scripts.git] / tests / t / format_other.t
blob9c53d56301ceac209632547c7863437f753d8bde
2 use warnings;
3 use strict;
5 use Test::More;
7 eval "use JSON::XS";
8 plan skip_all => "JSON::XS required for testing" if $@;
10 eval "use Test::Deep";
11 plan skip_all => "Test::Deep required for testing" if $@;
13 use Test::Quvi;
15 my $q = Test::Quvi->new;
17 plan skip_all => "TEST_SKIP rule"
18   if $q->test_skip("format_other");
20 my @files = $q->find_json(
21   qw(
22     data/format/other
23     data/format/default/ignore/length_bytes
24     )
27 plan skip_all => "Nothing to test" if scalar @files == 0;
28 plan tests => scalar @files * 2;
30 my $j   = $q->get_json_obj;
31 my $ign = qr|/ignore/(.*?)/|;
33 foreach (@files)
35   my $e = $q->read_json($_);
37   $q->mark_ignored(\$e, $1) if $_ =~ /$ign/;
39   my $f = $e->{format_requested};
40   my ($r, $o) = $q->run($e->{page_url}, "-qrf $f");
41   is($r, 0, "quvi exit status == 0")
42     or diag $e->{page_url};
43 SKIP:
44   {
45     skip 'quvi exit status != 0', 1 if $r != 0;
46     cmp_deeply($j->decode($o), $e, "compare with $_")
47       or diag $e->{page_url};
48   }
51 # vim: set ts=2 sw=2 tw=72 expandtab: