<commit_before>require 'test_common'
require 'timeout'

class Vacuous
  include Bud
end

class CallbackTest < Test::Unit::TestCase
  def test_111foreground1
    # note the test name.  we must run before all other tests, or run_fg will
    # throw "evenmachine already running" :(
    c = Vacuous.new
    assert_raise(Timeout::Error) do
      Timeout::timeout(0.1) do
        c.run_fg
      end
    end    
  end

  def test_11shutdown
    # similarly, this test must be run early, because it blocks if any eventmachines
    # are left running by other tests (which seems to be the case)
    c = Vacuous.new
    c.run_bg
    assert_nothing_raised {c.stop_bg(true)}
  end

  def test_already_running
    c1 = Vacuous.new
    c2 = Vacuous.new
    c1.run_bg
    assert_raise(Bud::BudError) {c2.run_fg}
    c1.stop_bg
  end

end
<commit_msg>more coverage<commit_after>require 'test_common'
require 'timeout'

class Vacuous
  include Bud
end

class CallbackTest < Test::Unit::TestCase
  def test_111foreground1
    # note the test name.  we must run before all other tests, or run_fg will
    # throw "evenmachine already running" :(
    c = Vacuous.new
    assert_raise(Timeout::Error) do
      Timeout::timeout(0.1) do
        c.run_fg
      end
    end    
  end

  def test_11shutdown
    # similarly, this test must be run early, because it blocks if any eventmachines
    # are left running by other tests (which seems to be the case)
    c = Vacuous.new
    c.run_bg
    assert_nothing_raised {c.stop_bg(true)}
  end

  def test_already_running
    c1 = Vacuous.new
    c2 = Vacuous.new
    c1.run_bg
    assert_raise(Bud::BudError) {c2.run_fg}
    c1.stop_bg
  end

  def test_interrogate1
    c = Vacuous.new
    assert_raise(Bud::BudError) {c.int_ip_port}
  end

  def test_interrogate2
    c = Vacuous.new
    c.run_bg
    assert_nothing_raised {c.int_ip_port}
  end

end

{'fraction_non_alphanumeric': 0.07085775173148641, 'fraction_numerical': 0.014917421417155035, 'mean_word_length': 2.9125, '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': '5135245', 'n_tokens_mistral': 685, 'n_tokens_neox': 638, 'n_words': 190}