<commit_before>require 'helper'

def completer_test(bind, pry=nil, assert_flag=true)
  test = proc {|symbol|
    Pry::InputCompleter.call(symbol[0..-2], :target => Pry.binding_for(bind), :pry => pry).include?(symbol).should  == assert_flag}
  return proc {|*symbols| symbols.each(&test) }
end

if defined?(Bond)
  describe 'bond-based completion' do
    it 'should pull in Bond by default' do
      Pry.config.completer.should == Pry::BondCompleter
    end
  end
end

describe Pry::InputCompleter do

  before do
    # The AMQP gem has some classes like this:
    #  pry(main)> AMQP::Protocol::Test::ContentOk.name
    #  => :content_ok
    module SymbolyName
      def self.name; :symboly_name; end<commit_msg>Fix completion spec for Ruby with editline<commit_after>require 'helper'

def completer_test(bind, pry=nil, assert_flag=true)
  test = proc {|symbol|
    Pry::InputCompleter.call(symbol[0..-2], :target => Pry.binding_for(bind), :pry => pry).include?(symbol).should  == assert_flag}
  return proc {|*symbols| symbols.each(&test) }
end

describe 'Bond-based completion' do
  it "should use Bond if it's available" do
    if defined?(Bond) && Readline::VERSION !~ /editline/i
      Pry.config.completer.should == Pry::BondCompleter
    else
      Pry.config.completer.should == Pry::InputCompleter
    end
  end
end

describe Pry::InputCompleter do
  before do
    # The AMQP gem has some classes like this:
    #  pry(main)> AMQP::Protocol::Test::ContentOk.name
    #  => :content_ok
    module SymbolyName
      def self.name; :symboly_name; end
{'fraction_non_alphanumeric': 0.12733118971061094, 'fraction_numerical': 0.002572347266881029, 'mean_word_length': 4.003215434083601, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '4518282', 'n_tokens_mistral': 549, 'n_tokens_neox': 539, 'n_words': 132}