<commit_before>require 'test/unit'
require 'pathname'

MYDIR = File.dirname(__FILE__)

$:.unshift 'lib'
require 'coderay'
puts "Running basic CodeRay #{CodeRay::VERSION} executable tests..."

class TestCodeRayExecutable < Test::Unit::TestCase
  
  ruby = `ps -c #$$`[/\w+\Z/]
  ruby = 'jruby' if ruby == 'java'
  
  ROOT_DIR = Pathname.new(File.dirname(__FILE__)) + '..' + '..'
  EXECUTABLE = ROOT_DIR + 'bin' + 'coderay2'
  EXE_COMMAND = '%s -wI%s %s'% [
    ruby,  # calling Ruby process command
    ROOT_DIR + 'lib',  # library dir
    EXECUTABLE
  ]
  
  def coderay args
    command = "#{EXE_COMMAND} #{args}"
    # puts command
    `#{command}`
  end
  
  def test_simple
    assert_equal '', coderay('')
  end
  
  VERSION_PATTERN = /\ACodeRay \d\.\d\.\d\n\z/
  def test_version
    assert_match(VERSION_PATTERN, coderay('--version'))
    assert_match(VERSION_PATTERN, coderay('-v'))
  end
  
  HELP_PATTERN = /Usage:/
  def test_help
    assert_match(HELP_PATTERN, coderay('--help'))
    assert_match(HELP_PATTERN, coderay('-h'))
  end
  
end<commit_msg>Fixing new executable test suite.<commit_after>require 'test/unit'
require 'pathname'

MYDIR = File.dirname(__FILE__)

$:.unshift 'lib'
require 'coderay'
puts "Running basic CodeRay #{CodeRay::VERSION} executable tests..."

class TestCodeRayExecutable < Test::Unit::TestCase
  
  ruby = `ps -c #$$`[/\w+\Z/]
  ruby = 'jruby' if ruby == 'java'
  
  ROOT_DIR = Pathname.new(File.dirname(__FILE__)) + '..' + '..'
  EXECUTABLE = ROOT_DIR + 'bin' + 'coderay'
  EXE_COMMAND = '%s -wI%s %s'% [
    ruby,  # calling Ruby process command
    ROOT_DIR + 'lib',  # library dir
    EXECUTABLE
  ]
  
  def coderay args
    command = "#{EXE_COMMAND} #{args}"
    # puts command
    `#{command}`
  end
  
  def test_simple
    assert_nothing_raised { coderay('') }
  end
  
  VERSION_PATTERN = /CodeRay \d\.\d\.\d/
  def test_version
    assert_match(VERSION_PATTERN, coderay(''))
    # assert_match(VERSION_PATTERN, coderay('--version'))
    # assert_match(VERSION_PATTERN, coderay('-v'))
  end
  
  HELP_PATTERN = /Usage:/
  def test_help
    assert_match(HELP_PATTERN, coderay(''))
    # assert_match(HELP_PATTERN, coderay('--help'))
    # assert_match(HELP_PATTERN, coderay('-h'))
  end
  
end
{'fraction_non_alphanumeric': 0.15723830734966593, 'fraction_numerical': 0.00044543429844097997, 'mean_word_length': 3.369649805447471, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1648780', 'n_tokens_mistral': 894, 'n_tokens_neox': 857, 'n_words': 175}