<commit_before>#!/usr/bin/perl
use strict;
use warnings;
use Test::More;
use File::Temp qw(tempdir);

use tool::Util;


my @files = glob 't/run/*.jsx';

plan tests => 4 * scalar @files;

{
    local $ENV{JSX_HOME} = tempdir(".jsx.mode-parse-XXXXXXXX", CLEANUP => 1);

    require tool::RunCompilationServer;
    require "tool/jsx.pl"; # App::jsx

    my $port = do {
        open my $fh, "<", "$ENV{JSX_HOME}/port" or die $!;
        <$fh>;
    };

    foreach my $file(@files) {
        local $TODO = "todo" if $file =~ / \.todo\. /xms;

        my $res = App::jsx::request($port, "--mode", "parse", $file);

        ok !$res->{invalid_response}, "--mode parse $file";
        is $res->{statusCode}, 0, "statusCode for $file";
        is $res->{stderr}, "", "stderr for $file";
        ok $res->{stdout}, "stdout for $file"
    }
}
<commit_msg>t/007.mode-parse.t no longer uses the compile server (revert to 6aef8d8, and add cherry-pick support from 5effa40)<commit_after>#!/usr/bin/perl
use strict;
use warnings;
use Test::More;

my @files = glob 't/run/*.jsx';

plan tests => 2 * scalar @files;

foreach my $file(@files) {
    local $TODO = "todo" if $file =~ / \.todo\. /xms;
    my $json = `bin/jsx --mode parse $file`;
    is $?, 0, "bin/jsx --mode parse $file";
    ok $json;
}


{'fraction_non_alphanumeric': 0.19517884914463451, 'fraction_numerical': 0.01088646967340591, 'mean_word_length': 2.830357142857143, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 1, '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': '188928', 'n_tokens_mistral': 510, 'n_tokens_neox': 482, 'n_words': 133}