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

$LOAD_PATH << File.expand_path(File.join('..', 'lib'), __dir__)
$LOAD_PATH << File.expand_path(File.join('..', 'test'), __dir__)

require 'minitest'
require 'English'

#
# Helper class to aid running minitest
#
class MinitestRunner
  def initialize
    @test_suites = extract_from_argv { |cmd_arg| test_suite?(cmd_arg) }
  end

  def run
    test_suites.each { |f| require File.expand_path(f) }

    flags = ["--name=/#{filtered_methods.join('|')}/", ENV['TESTOPTS']]

    run_with_timeout(flags)
  end

  private

  def run_with_timeout(flags)
    Timeout.timeout(180) { Minitest.run(flags + $ARGV) }
  rescue Timeout::Error
    false
  end

  def runnables
    Minitest::Runnable.runnables
  end

  def test_suite?(str)
    all_test_suites.include?(str)
  end<commit_msg>Allow passing multiple TESTOPTS to test runner<commit_after>#!/usr/bin/env ruby

$LOAD_PATH << File.expand_path(File.join('..', 'lib'), __dir__)
$LOAD_PATH << File.expand_path(File.join('..', 'test'), __dir__)

require 'minitest'
require 'English'
require 'shellwords'

#
# Helper class to aid running minitest
#
class MinitestRunner
  def initialize
    @test_suites = extract_from_argv { |cmd_arg| test_suite?(cmd_arg) }
  end

  def run
    test_suites.each { |f| require File.expand_path(f) }

    flags = ["--name=/#{filtered_methods.join('|')}/", *test_opts]

    run_with_timeout(flags)
  end

  private

  def run_with_timeout(flags)
    Timeout.timeout(180) { Minitest.run(flags + $ARGV) }
  rescue Timeout::Error
    false
  end

  def runnables
    Minitest::Runnable.runnables
  end

  def test_suite?(str)
    all_test_suites.include?(str)
  end

  def test_opts
    return [] unless ENV['TESTOPTS']

    ENV['TESTOPTS'].shellsplit
  end
{'fraction_non_alphanumeric': 0.13757816941444, 'fraction_numerical': 0.0034110289937464467, 'mean_word_length': 4.0285714285714285, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, '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': '1328334', 'n_tokens_mistral': 668, 'n_tokens_neox': 646, 'n_words': 130}