Sha256: 8219f8f7a6d8a71c6fe37f779018fa83cf6023373edd725ad0d114f660ab5338

Contents?: true

Size: 1013 Bytes

Versions: 3

Compression:

Stored size: 1013 Bytes

Contents

require 'helper'

class TestIdentity < Test::Unit::TestCase
  def test_001_identical
    i = FuzzyMatch::Identity.new %r{(A)[ ]*(\d)}
    assert_equal true, i.identical?('A1', 'A     1foobar')
  end
  
  def test_002_certainly_different
    i = FuzzyMatch::Identity.new %r{(A)[ ]*(\d)}
    assert_equal false, i.identical?('A1', 'A     2foobar')    
  end
  
  def test_003_no_information_ie_possible_identical
    i = FuzzyMatch::Identity.new %r{(A)[ ]*(\d)}
    assert_equal nil, i.identical?('B1', 'A     2foobar')    
  end

  def test_004_regexp
    i = FuzzyMatch::Identity.new %r{\A\\?/(.*)etc/mysql\$$}
    assert_equal %r{\A\\?/(.*)etc/mysql\$$}, i.regexp
  end
  
  def test_005_regexp_from_string
    i = FuzzyMatch::Identity.new '%r{\A\\\?/(.*)etc/mysql\$$}'
    assert_equal %r{\A\\?/(.*)etc/mysql\$$}, i.regexp
  end
  
  def test_006_regexp_from_string_using_slash_delim
    i = FuzzyMatch::Identity.new '/\A\\\?\/(.*)etc\/mysql\$$/'
    assert_equal %r{\A\\?/(.*)etc/mysql\$$}, i.regexp
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fuzzy_match-1.1.1 test/test_identity.rb
fuzzy_match-1.1.0 test/test_identity.rb
fuzzy_match-1.0.5 test/test_identity.rb