Akron | e2b902d | 2016-08-16 16:50:11 +0200 | [diff] [blame] | 1 | #/usr/bin/env perl |
| 2 | use strict; |
| 3 | use warnings; |
| 4 | use File::Basename 'dirname'; |
| 5 | use File::Spec::Functions qw/catdir catfile/; |
| 6 | use File::Temp qw/ :POSIX /; |
Akron | 5fd2d8e | 2017-06-19 15:29:39 +0200 | [diff] [blame] | 7 | use Mojo::File; |
Akron | e2b902d | 2016-08-16 16:50:11 +0200 | [diff] [blame] | 8 | use Mojo::JSON qw/decode_json/; |
| 9 | use IO::Uncompress::Gunzip; |
| 10 | use Test::More; |
| 11 | use Test::Output; |
| 12 | use Data::Dumper; |
| 13 | |
Akron | fab17d3 | 2020-07-31 14:38:29 +0200 | [diff] [blame] | 14 | if ($ENV{SKIP_SCRIPT}) { |
| 15 | plan skip_all => 'Skip script tests'; |
| 16 | }; |
| 17 | |
Akron | e2b902d | 2016-08-16 16:50:11 +0200 | [diff] [blame] | 18 | my $f = dirname(__FILE__); |
| 19 | my $script = catfile($f, '..', '..', 'script', 'korapxml2krill'); |
| 20 | ok(-f $script, 'Script found'); |
| 21 | |
| 22 | stdout_like( |
| 23 | sub { system('perl', $script) }, |
| 24 | qr!Usage.+?korapxml2krill!s, |
| 25 | 'Usage output' |
| 26 | ); |
| 27 | |
| 28 | stdout_like( |
| 29 | sub { system('perl', $script, '--help') }, |
| 30 | qr!Usage.+?korapxml2krill!s, |
| 31 | 'Usage output' |
| 32 | ); |
| 33 | |
| 34 | stdout_like( |
| 35 | sub { system('perl', $script, '--version') }, |
| 36 | qr!Version \d+\.\d+!s, |
| 37 | 'Version output' |
| 38 | ); |
| 39 | |
| 40 | done_testing; |
| 41 | __END__ |