<commit_before>require 'rubygems'
require 'spec'
require 'set'

$: << File.dirname(__FILE__)
$: << File.join(File.dirname(__FILE__),'../lib')

# Loads uppercut and jabber
require 'uppercut'

# Unloads jabber, replacing it with a stub
require 'jabber_stub'

class TestAgent < Uppercut::Agent
  command 'hi' do |c|
    c.instance_eval { @base.instance_eval { @called_hi = true } }
    c.send 'called hi'
  end
  
  command /^hi/ do |c|
    c.instance_eval { @base.instance_eval { @called_hi_regex = true } }
    c.send 'called high regex'
  end
  
  command /(good)?bye/ do |c,good|
    @called_goodbye = true
    c.send good ? "Good bye to you as well!" : "Rot!"
  end
  
  command 'wait' do |c|
    @called_wait = true
    c.send 'Waiting...'
    c.wait_for do |reply|
      @called_wait_block = true
      c.send 'Hooray!'
    end
  end<commit_msg>Tweak for new dispatch system.<commit_after>require 'rubygems'
require 'spec'
require 'set'

$: << File.dirname(__FILE__)
$: << File.join(File.dirname(__FILE__),'../lib')

# Loads uppercut and jabber
require 'uppercut'

# Unloads jabber, replacing it with a stub
require 'jabber_stub'

class TestAgent < Uppercut::Agent
  command 'hi' do |c,args|
    c.instance_eval { @base.instance_eval { @called_hi = true } }
    c.send 'called hi'
  end
  
  command /^hi/ do |c,args|
    c.instance_eval { @base.instance_eval { @called_hi_regex = true } }
    c.send 'called high regex'
  end
  
  command /(good)?bye/ do |c,args|
    @called_goodbye = true
    c.send args.first ? "Good bye to you as well!" : "Rot!"
  end
  
  command 'wait' do |c,args|
    @called_wait = true
    c.send 'Waiting...'
    c.wait_for do |reply|
      @called_wait_block = true
      c.send 'Hooray!'
    end
  end
{'fraction_non_alphanumeric': 0.13536866359447006, 'fraction_numerical': 0.0, 'mean_word_length': 3.0870588235294116, 'pattern_counts': {'":': 0, '<': 13, '<?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': '2182378', 'n_tokens_mistral': 640, 'n_tokens_neox': 647, 'n_words': 171}