]> iEval git - zeal.git/blame - t/Zeal-Feed.t
Make Zeal SYNOPSIS prettier (and wider)
[zeal.git] / t / Zeal-Feed.t
CommitLineData
adb8c792
MG
1#!/usr/bin/perl
2use strict;
3use warnings;
4
5use Test::More tests => 23;
6BEGIN { use_ok('Zeal::Feed') };
7
8my $feed = Zeal::Feed->new_from_file('t/feed.xml');
9is $feed->version, '1.2.3', 'feed version is 1.2.3';
10my @urls = sort $feed->urls;
11my $url_re = qr,^http://srv[12]\.example\.com/feed\.tar\.gz$,;
12like $urls[$_-1], $url_re, "feed url $_ is correct" for 1, 2;
13like $feed->url, $url_re, 'feed random url is correct';
14
15use File::Temp qw/tempdir/;
16
17sub test_unpack {
18 my ($arch) = @_;
19 my $dir = tempdir 'zeal-testXXXX', TMPDIR => 1, CLEANUP => 1;
20 note "Testing unpack of $arch";
21 Zeal::Feed::_unpack_tar_to_dir($arch, $dir);
22 ok -d "$dir/a.docset", 'Root directory of unpacked docset exists';
23 ok -f "$dir/a.docset/Contents/Info.plist", 'Info.plist exists';
24}
25
26note "Testing unpack with default tar";
27test_unpack $_ for 't/a.tar', 't/a.tar.gz', 't/a.tar.bz2';
28note "Testing unpack with Archive::Tar by env variable";
29$ENV{ZEAL_USE_INTERNAL_TAR} = 1;
30test_unpack $_ for 't/a.tar', 't/a.tar.gz', 't/a.tar.bz2';
31note "Testing unpack with Archive::Tar by clearing PATH";
32$ENV{ZEAL_USE_INTERNAL_TAR} = 0;
33$ENV{PATH} = '';
34test_unpack $_ for 't/a.tar', 't/a.tar.gz', 't/a.tar.bz2';
This page took 0.031494 seconds and 4 git commands to generate.