Skip to content

Commit

Permalink
Make ruby tests dynamic
Browse files Browse the repository at this point in the history
  • Loading branch information
H.Merijn Brand - Tux committed May 11, 2017
1 parent 1c22a1a commit d07dfce
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions time.pl
Expand Up @@ -9,7 +9,8 @@ sub usage {
exit $err;
} # usage

use Time::HiRes qw( gettimeofday tv_interval );
use List::Util qw( max );
use Time::HiRes qw( gettimeofday tv_interval );
use Getopt::Long qw(:config bundling);
my $opt_6 = 1;
GetOptions (
Expand All @@ -31,8 +32,6 @@ sub usage {

my %lang = (
## ext prog args
0 => [ ".rb", "ruby2.1", ],
1 => [ ".rb", "ruby2.2", ],
2 => [ ".py", "python2", ],
3 => [ ".py", "python3", ],
4 => [ ".php", "php", "-nq" ],
Expand Down Expand Up @@ -75,8 +74,6 @@ sub usage {
[ 11, 0, "csv-java8" ],
[ 14, 0, "csv-java6" ],
[ 10, 0, "csv-java7" ],
[ 0, 0, "csv-ruby" ],
[ 1, 0, "csv-ruby" ],
[ 8, 0, "csv-go" ],
[ 13, 0, "csv-R" ],
[ 12, 0, "csv-java9" ],
Expand All @@ -85,6 +82,12 @@ sub usage {
[ 17, 0, "csv-rust-libcsv" ],
[ 17, 0, "csv-rust-qckrdr" ],
);
my $li = max keys %lang;
foreach my $re (grep { -x } sort glob "/usr/bin/ruby[0-9]*") {
$re =~ s{.*/}{};
$lang{++$li} = [ ".rb", $re, ];
push @test, [ $li, 0, "csv-ruby" ];
}

sub runfrom {
my ($v, $script, $file) = @_;
Expand Down

0 comments on commit d07dfce

Please sign in to comment.