#!/usr/bin/env perl
use strict;
use v5.10;
use Test::More;
use File::Basename;

# TODO: make this a subtest or something linke Pandoc::Test::Run?

use lib 'xt/lib';
use Pandoc::Releases;

my @version;
while (@ARGV and $ARGV[0] =~ /^[v0-9., <>=!]+$/) {
    # Use only this version if a simple version number is specified
    push @version, map { $_ =~ /[<>=]/ ? $_ : "==$_" } shift @ARGV;
}

my $PATH = $ENV{PATH};

foreach my $pandoc (pandoc_releases) {
    next unless $pandoc->version(join ', ', @version);
    note $pandoc->bin;
    local $ENV{PATH} = dirname($pandoc->bin).":$PATH";
    local $ENV{RELEASE_TESTING} = 1;
    system('prove', '-l', @ARGV);
}

done_testing;
