<commit_before>#!/usr/bin/env perl

use strict;
use Cwd;

my $exitstatus = 0;
my @idrOpts    = ();

sub runtest {
    my ($test, $update) = @_;

    chdir($test);

    print "Running $test...\n";
    my $got = `sh ./run @idrOpts`;
    my $exp = `cat expected`;

    open my $out, '>', 'output';
    print $out $got;
    close $out;

    # $ok = system("diff output expected &> /dev/null");
    # Mangle newlines in $got and $exp
    $got =~ s/\r\n/\n/g;
    $exp =~ s/\r\n/\n/g;

    # Normalize paths in $got and $exp, so the expected outcomes don't
    # change between platforms
    while($got =~ /(^|.*?\n)(.*?)\\(.*?):(\d+):(.*)/ms) {
        $got = "$1$2/$3:$4:$5";
    }
    while($exp =~ /(^|.*?\n)(.*?)\\(.*?):(\d+):(.*)/ms) {
        $exp = "$1$2/$3:$4:$5";
    }

    if ($got eq $exp) {<commit_msg>Make runtest.pl execute run scripts directly<commit_after>#!/usr/bin/env perl

use strict;
use Cwd;

my $exitstatus = 0;
my @idrOpts    = ();

sub runtest {
    my ($test, $update) = @_;

    chdir($test);

    print "Running $test...\n";
    my $got = `./run @idrOpts`;
    my $exp = `cat expected`;

    open my $out, '>', 'output';
    print $out $got;
    close $out;

    # $ok = system("diff output expected &> /dev/null");
    # Mangle newlines in $got and $exp
    $got =~ s/\r\n/\n/g;
    $exp =~ s/\r\n/\n/g;

    # Normalize paths in $got and $exp, so the expected outcomes don't
    # change between platforms
    while($got =~ /(^|.*?\n)(.*?)\\(.*?):(\d+):(.*)/ms) {
        $got = "$1$2/$3:$4:$5";
    }
    while($exp =~ /(^|.*?\n)(.*?)\\(.*?):(\d+):(.*)/ms) {
        $exp = "$1$2/$3:$4:$5";
    }

    if ($got eq $exp) {
{'fraction_non_alphanumeric': 0.26274271844660196, 'fraction_numerical': 0.013349514563106795, 'mean_word_length': 2.220703125, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1304269', 'n_tokens_mistral': 710, 'n_tokens_neox': 683, 'n_words': 162}