Chandra
view release on metacpan or search on metacpan
t/63_pack.t view on Meta::CPAN
ok(!$mods{'Cpanel::JSON::XS'}, 'excluded module not in deps');
}
# Include option
{
my $p = Chandra::Pack->new(
script => $script,
include => ['Carp'],
);
my @deps = $p->scan_deps;
my %mods = map { $_->{module} => 1 } @deps;
ok($mods{'Carp'}, 'included module found in deps');
}
# ââ Info.plist Generation ââââââââââââââââââââââââââââââââââââââââââââ
{
my $p = Chandra::Pack->new(
script => $script,
name => 'My App',
version => '1.2.3',
identifier => 'com.test.myapp',
);
my $plist = $p->_generate_plist;
like($plist, qr/CFBundleName/, 'plist has CFBundleName');
like($plist, qr/My App/, 'plist has app name');
like($plist, qr/com\.test\.myapp/, 'plist has identifier');
like($plist, qr/1\.2\.3/, 'plist has version');
like($plist, qr/CFBundleExecutable/, 'plist has executable key');
like($plist, qr/NSHighResolutionCapable/, 'plist has retina flag');
like($plist, qr/<\?xml/, 'plist has XML header');
like($plist, qr/<\/plist>/, 'plist has closing tag');
}
# ââ Launcher Generation âââââââââââââââââââââââââââââââââââââââââââââ
{
my $p = Chandra::Pack->new(script => $script);
my $mac = $p->_generate_launcher_macos;
like($mac, qr/^#!\/bin\/bash/, 'macos launcher is bash');
like($mac, qr/PERL5LIB/, 'macos launcher sets PERL5LIB');
like($mac, qr/exec/, 'macos launcher execs perl');
like($mac, qr/script\.pl/, 'macos launcher runs script.pl');
my $linux = $p->_generate_launcher_linux;
like($linux, qr/^#!\/bin\/bash/, 'linux launcher is bash');
like($linux, qr/PERL5LIB/, 'linux launcher sets PERL5LIB');
like($linux, qr/usr\/share\/script\.pl/, 'linux launcher path correct');
my $win = $p->_generate_launcher_windows;
like($win, qr/\@echo off/i, 'windows launcher has echo off');
like($win, qr/PERL5LIB/, 'windows launcher sets PERL5LIB');
like($win, qr/script\.pl/, 'windows launcher runs script.pl');
}
# ââ Desktop Entry Generation ââââââââââââââââââââââââââââââââââââââââ
{
my $p = Chandra::Pack->new(script => $script, name => 'Test App');
my $desktop = $p->_generate_desktop;
like($desktop, qr/\[Desktop Entry\]/, 'desktop has header');
like($desktop, qr/Type=Application/, 'desktop is Application type');
like($desktop, qr/Name=Test App/, 'desktop has name');
like($desktop, qr/Exec=\.\/AppRun/, 'desktop exec is AppRun');
}
# ââ Platform Detection âââââââââââââââââââââââââââââââââââââââââââââââ
{
my $p = Chandra::Pack->new(script => $script);
my $plat = $p->platform;
if ($^O eq 'darwin') {
is($plat, 'macos', 'detects macos');
} elsif ($^O eq 'MSWin32') {
is($plat, 'windows', 'detects windows');
} else {
is($plat, 'linux', 'detects linux/other');
}
}
done_testing;
( run in 0.899 second using v1.01-cache-2.11-cpan-df04353d9ac )