Sha256: 242e78f3679cb785319d59b3d6b2e43b3ba1a2ae722345421ceddfcb6acd7b75

Contents?: true

Size: 1.12 KB

Versions: 4

Compression:

Stored size: 1.12 KB

Contents

require File.join(File.dirname(__FILE__), 'test_helper')

class Bond::CompletionTest < Test::Unit::TestCase
  before(:all) { Bond.reset; Bond.debrief(:readline_plugin=>valid_readline_plugin); require 'bond/completion' }

  test "completes object methods anywhere" do
    matches = tabtab("blah :man.")
    assert matches.size > 0
    assert matches.all? {|e| e=~ /^:man/}
  end

  test "completes global variables anywhere" do
    matches = tabtab("blah $-")
    assert matches.size > 0
    assert matches.all? {|e| e=~ /^\$-/}
  end

  test "completes absolute constants anywhere" do
    tabtab("blah ::Arr").should == ["::Array"]
  end

  test "completes nested classes anywhere" do
    tabtab("blah IRB::In").should == ["IRB::InputCompletor"]
  end

  test "completes symbols anywhere" do
    Symbol.expects(:all_symbols).returns([:mah])
    assert tabtab("blah :m").size > 0
  end

  test "completes string methods anywhere" do
    tabtab("blah 'man'.f").include?('.freeze').should == true
  end

  test "methods don't swallow up default completion" do
    Bond.agent.find_mission("Bond.complete(:method=>'blah') { Arr").should == nil
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
cldwalker-bond-0.1.3 test/completion_test.rb
cldwalker-bond-0.1.4 test/completion_test.rb
bond-0.1.3 test/completion_test.rb
bond-0.1.4 test/completion_test.rb