Sha256: 7cd421e3337c0580bf0b9e4f04ec8639735424a696cb4bfe3b0823e8d8e05331
Contents?: true
Size: 1.52 KB
Versions: 2
Compression:
Stored size: 1.52 KB
Contents
require File.join(File.dirname(__FILE__), 'test_helper') class Bond::SearchTest < Test::Unit::TestCase before(:all) {|e| Bond.debrief(:readline_plugin=>valid_readline_plugin) } before(:each) {|e| Bond.agent.instance_eval("@missions = []") } context "mission with search" do test "false completes" do Bond.complete(:on=>/cool '(.*)/, :search=>false) {|e| %w{coco for puffs}.grep(/#{e.matched[1]}/) } complete("cool 'ff").should == ['puffs'] end test "proc completes" do Bond.complete(:method=>'blah', :search=>proc {|input, list| list.grep(/#{input}/)}) {|e| %w{coco for puffs} } complete("blah 'ff").should == ['puffs'] end test ":anywhere completes" do Bond.complete(:method=>'blah', :search=>:anywhere) {|e| %w{coco for puffs} } complete("blah 'ff").should == ['puffs'] end test ":ignore_case completes" do Bond.complete(:method=>'blah', :search=>:ignore_case) {|e| %w{Coco For PufFs} } complete("blah 'pu").should == ['PufFs'] end test ":underscore completes" do Bond.complete(:on=>/blah/, :search=>:underscore) {|e| %w{and_one big_two can_three} } complete("blah and").should == ['and_one'] complete("blah b-t").should == ['big_two'] end end test "search handles completions with regex characters" do completions = ['[doh]', '.*a', '?ok'] Bond.complete(:on=>/blah/) { completions } complete('blah .').should == ['.*a'] complete('blah [').should == ['[doh]'] complete('blah ?').should == ['?ok'] end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
cldwalker-bond-0.1.1 | test/search_test.rb |
bond-0.1.1 | test/search_test.rb |