Sha256: 5c7ba43943e51ae0c97a0927825e20c45c6bd3ebe533211dfa7752e9af4386d9

Contents?: true

Size: 596 Bytes

Versions: 11

Compression:

Stored size: 596 Bytes

Contents

require 'facets/string/splice'
require 'test/unit'

class TC_String < Test::Unit::TestCase

  def test_splice
    a = "HELLO"
    assert_equal( "E", a.splice(1) )
    assert_equal( "HLLO", a )
  end

  # This could be done if class of 2nd arg is checked.
  #def test_splice_length
  #  a = "HELLO"
  #  assert_equal( "EL", a.splice(1,2) )
  #  assert_equal( "HLO", a )
  #end

  def test_splice_range
    a = "HELLO"
    assert_equal( "EL", a.splice(1..2) )
    assert_equal( "HLO", a )
  end

  def test_splice_store
    a = "HELLO"
    a.splice(1, "X")
    assert_equal("HXLLO", a)
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
facets-2.8.4 test/core/string/test_splice.rb
facets-2.8.3 test/core/string/test_splice.rb
facets-2.8.2 test/core/string/test_splice.rb
facets-2.8.1 test/core/string/test_splice.rb
facets-2.8.0 test/core/string/test_splice.rb
facets-2.7.0 test/core/string/test_splice.rb
facets-2.6.0 test/core/string/test_splice.rb
facets-2.5.1 test/core/string/test_splice.rb
facets-2.5.0 test/core/string/test_splice.rb
facets-2.4.5 test/core/string/test_splice.rb
facets-2.5.2 test/core/string/test_splice.rb