Sha256: 6fd427084f133017972820c1990a3b3673d4be862f9f11a620b3e7c8a2982d14

Contents?: true

Size: 634 Bytes

Versions: 2

Compression:

Stored size: 634 Bytes

Contents

# Test for lib/facets/matchdata/matchset

require 'facets/matchdata/matchset.rb'

require 'test/unit'

class Test_MatchData_Matchset < Test::Unit::TestCase

  def test_matchtree_01
    md = /(bb)(cc(dd))(ee)/.match "XXaabbccddeeffXX"
    assert_equal( [["bb"], ["cc", ["dd"]], ["ee"]] , md.matchtree )
  end

  def test_matchtree_02
    md = /(bb)c(c(dd))(ee)/.match "XXaabbccddeeffXX"
    assert_equal( [["bb"], "c", ["c", ["dd"]], ["ee"]] , md.matchtree )
  end

  def test_matchset
    md = /(bb)(cc(dd))(ee)/.match "XXaabbccddeeffXX"
    assert_equal( ["XXaa", [["bb"], ["cc", ["dd"]], ["ee"]], "ffXX"] , md.matchset )
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
facets-2.2.1 test/unit/matchdata/test_matchset.rb
facets-2.3.0 test/core/matchdata/test_matchset.rb