blob: 89577fb58b1deee262875f308b290fe929decb10 [file] [log] [blame]
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More;
use File::Basename;
use File::Spec::Functions;
use Data::Dumper;
use File::Temp qw/tempdir/;
use Test::Output;
use Mojo::JSON 'decode_json';
my $script = catfile(dirname(__FILE__), '..', 'script', 'cosmasvc2koralquery');
my $copysrc = catdir(dirname(__FILE__), 'data');
my $list1 = catfile(dirname(__FILE__), 'data', 'list-example.ls');
my $output = tempdir( CLEANUP => 1 );
my @call = ($script, 'list', $list1, '--copy-src', $copysrc, '--output', $output);
# Check STDOUT
stderr_like(
sub {
system(@call);
},
qr!redabs is not yet supported!,
"check stdout"
);
# Check JSON
my $protocol = join('', `@call`);
like($protocol, qr!bih from regex!);
ok(-f catfile($output, 'bih.json'));
like($protocol, qr!bio from regex!);
ok(-f catfile($output, 'bio.json'));
like($protocol, qr!bio-pub from regex!);
ok(-f catfile($output, 'bio-pub.json'));
like($protocol, qr!l from regex!);
ok(-f catfile($output, 'l.json'));
like($protocol, qr!dpa from regex!);
ok(-f catfile($output, 'dpa.json'));
like($protocol, qr!fsp from regex!);
ok(-f catfile($output, 'fsp.json'));
like($protocol, qr!fsp-pub from regex!);
ok(-f catfile($output, 'fsp-pub.json'));
like($protocol, qr!kjl from regex!);
ok(-f catfile($output, 'kjl.json'));
like($protocol, qr!thm-lit from regex!);
ok(-f catfile($output, 'thm-lit.json'));
like($protocol, qr!wxx11 from regex!);
ok(-f catfile($output, 'wxx11.json'));
like($protocol, qr!zca from regex!);
ok(-f catfile($output, 'zca.json'));
like($protocol, qr!list2 from def-file!);
ok(-f catfile($output, 'list2.json'));
like($protocol, qr!list5 from def-file!);
ok(-f catfile($output, 'list5.json'));
like($protocol, qr!misc-lit from regex!);
ok(-f catfile($output, 'misc-lit.json'));
done_testing;
__END__