Sha256: a195d8224ab41a46ab28d2c92013f8c222f9432d2d87bce1d7baf9749d4b2384
Contents?: true
Size: 974 Bytes
Versions: 1
Compression:
Stored size: 974 Bytes
Contents
require 'test/unit' require 'contrib/redcloth-3.0.3' require 'soks-view' class TestBruteMatch < Test::Unit::TestCase def setup @match = BruteMatch.new @match['one'] = :one @match['two'] = :two @match['one two'] = :one_two @match['two three'] = :two_three @match['three: four'] = :three_colon_four end def test_basic assert_equal( [['three: four',:three_colon_four],['two',:two]], match('two three: four or more') ) end def test_case assert_equal( [['One',:one]] , match('One') ) end def test_length assert_equal( [['one two',:one_two]], match("a one two\nthree four") ) assert_equal( [['two three',:two_three],['one',:one]], match('a one two three four') ) end def test_fullwords assert_equal( [['two',:two]], match('aone two.') ) assert_equal( [['two three',:two_three]], match('two three: fourormore') ) end def match( text ) matches = [] @match.match( text ) { |m,p| matches << [m,p] "$1" } matches end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
Soks-0.0.7 | test/test_soks-view.rb |