Sha256: 92d5c068718662f7d18c069cad7d0011c5096c396fd25ed6ca6d122134bfd858

Contents?: true

Size: 948 Bytes

Versions: 31

Compression:

Stored size: 948 Bytes

Contents

require 'test/unit'
require 'bitclust'
require 'bitclust/simplesearcher'
require 'optparse'


class TestSearcher <  Test::Unit::TestCase

  def setup
    s = <<HERE
= class Hoge
== Class Methods
--- hoge
= class Hoge::Bar
== Class Methods
--- bar
= reopen Kernel
== Special Variables
--- $spespe

--- $/

--- $$
HERE
    _, @db = BitClust::RRDParser.parse(s, 'hoge')
  end

  include BitClust::SimpleSearcher
  def test_simple_search
    [['Ho',     'Hoge'],
     ['Hoge.h', 'hoge'],
     ['$sp',    'spespe'],
     ['$/',     '/'],
     ['$$',     '$'],
     ['B.b',    'bar'],
     ['Hoge::B','Hoge::Bar'],
     ['B b',    'bar'],
     [' B b c ','bar'],
     ['b B',    'bar'],
    ].each{|q, expected|
      ret = search_pattern(@db, q)
      assert_not_equal([], ret, q)
      assert_equal(expected, ret[0].name, q)
    }
    assert_equal([], search_pattern(@db, " "), 'space')
    assert_equal([], search_pattern(@db, ""), 'blank')
  end
end

Version data entries

31 entries across 27 versions & 1 rubygems

Version Path
bitclust-core-1.3.0 test/test_simplesearcher.rb
bitclust-core-1.2.6 test/test_simplesearcher.rb
bitclust-core-1.2.5 test/test_simplesearcher.rb
bitclust-core-1.2.4 test/test_simplesearcher.rb
bitclust-core-1.2.3 test/test_simplesearcher.rb
bitclust-core-1.2.2 test/test_simplesearcher.rb
bitclust-core-1.2.1 test/test_simplesearcher.rb
bitclust-core-1.2.0 test/test_simplesearcher.rb
bitclust-core-1.1.1 test/test_simplesearcher.rb
bitclust-core-1.1.0 test/test_simplesearcher.rb
bitclust-core-1.0.0 test/test_simplesearcher.rb
bitclust-core-0.9.6 test/test_simplesearcher.rb
bitclust-core-0.9.5 test/test_simplesearcher.rb
bitclust-core-0.9.4 test/test_simplesearcher.rb
bitclust-core-0.9.3 test/test_simplesearcher.rb
bitclust-core-0.9.2 test/test_simplesearcher.rb
bitclust-core-0.9.1 test/test_simplesearcher.rb
bitclust-core-0.9.0 test/test_simplesearcher.rb
bitclust-core-0.8.0 test/test_simplesearcher.rb
bitclust-core-0.7.0 test/test_simplesearcher.rb