/vendor/gems/facets-2.4.5/test/core/string/test_splice.rb
Ruby | 32 lines | 19 code | 7 blank | 6 comment | 0 complexity | 13889ae35e4a91f0ee15d3797614e7d6 MD5 | raw file
Possible License(s): GPL-3.0, GPL-2.0, IPL-1.0, AGPL-1.0, LGPL-3.0
- 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