<commit_before>require File.join(File.dirname(__FILE__), 'test_helper')
require 'boson/bin_runner'
BinRunner = Boson::BinRunner

describe "BinRunner" do
  def aborts_with(regex)
    BinRunner.expects(:abort).with {|e| e[regex] }
    yield
  end

  # disable rubinius until Open3.spawn defined in Bahia
  unless ENV['FAST'] || RUBY_DESCRIPTION.include?('rubinius')
    it "prints usage with no arguments" do
      boson
      stdout.should =~ /^boson/
    end

    it "prints usage with --help" do
      %w{-h --help}.each do |option|
        boson option
        stdout.should =~ /^boson/
      end
    end

    it 'prints version with --version' do
      boson '--version'
      stdout.chomp.should == "boson #{Boson::VERSION}"
    end

    it "executes string with --execute" do
      %w{--execute -e}.each do |option|
        boson "#{option} 'print 1 + 1'"<commit_msg>disable bahia tests for jrube because its no bueno :zap:<commit_after>require File.join(File.dirname(__FILE__), 'test_helper')
require 'boson/bin_runner'
BinRunner = Boson::BinRunner

describe "BinRunner" do
  def aborts_with(regex)
    BinRunner.expects(:abort).with {|e| e[regex] }
    yield
  end

  unless ENV['FAST'] ||
    # disable rubinius until Open3.spawn defined in Bahia
    # disable jruby until Open3.spawn works with ENV in Bahia
    RUBY_DESCRIPTION.include?('rubinius') || RUBY_PLATFORM[/java/]

    it "prints usage with no arguments" do
      boson
      stdout.should =~ /^boson/
    end

    it "prints usage with --help" do
      %w{-h --help}.each do |option|
        boson option
        stdout.should =~ /^boson/
      end
    end

    it 'prints version with --version' do
      boson '--version'
      stdout.chomp.should == "boson #{Boson::VERSION}"
    end

    it "executes string with --execute" do
      %w{--execute -e}.each do |option|
        boson "#{option} 'print 1 + 1'"
{'fraction_non_alphanumeric': 0.126528442317916, 'fraction_numerical': 0.003721424774056353, 'mean_word_length': 2.734126984126984, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7285180', 'n_tokens_mistral': 660, 'n_tokens_neox': 627, 'n_words': 180}