Sha256: 28ca322cbeb77029e4124810d8704c25b737c5da6e02ee372decc0afd3746a56

Contents?: true

Size: 583 Bytes

Versions: 16

Compression:

Stored size: 583 Bytes

Contents

require 'facets/string/to_re'
require 'test/unit'

class TestStringToRe < Test::Unit::TestCase

  def test_to_re
    assert_equal( /abc/, "abc".to_re )
    assert_equal( /a+bc/, "a+bc".to_re )
    assert_equal( /a+bc/, "a+bc".to_re(false) )
    assert_equal( /a\+bc/, "a+bc".to_re(true) )
  end

  def test_to_rx
    assert_equal( /abc/, "abc".to_rx )
    assert_equal( /a\+bc/, "a+bc".to_rx )
    assert_equal( /a+bc/, "a+bc".to_rx(false) )
    assert_equal( /a\+bc/, "a+bc".to_rx(true) )
  end

  def test_to_rx2
    a = "?"
    b = /#{a.to_rx}/
    assert( b =~ "?" )
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
facets-2.8.4 test/core/string/test_to_re.rb
facets-2.8.3 test/core/string/test_to_re.rb
facets-2.8.2 test/core/string/test_to_re.rb
facets-2.8.1 test/core/string/test_to_re.rb
facets-2.8.0 test/core/string/test_to_re.rb
facets-2.7.0 test/core/string/test_to_re.rb
facets-2.6.0 test/core/string/test_to_re.rb
facets-2.4.0 test/string/test_to_re.rb
facets-2.4.1 test/string/test_to_re.rb
facets-2.4.2 test/core/string/test_to_re.rb
facets-2.4.3 test/core/string/test_to_re.rb
facets-2.4.4 test/core/string/test_to_re.rb
facets-2.5.1 test/core/string/test_to_re.rb
facets-2.4.5 test/core/string/test_to_re.rb
facets-2.5.0 test/core/string/test_to_re.rb
facets-2.5.2 test/core/string/test_to_re.rb