PageRenderTime 25ms CodeModel.GetById 1ms RepoModel.GetById 0ms app.codeStats 0ms

/vendor/gems/facets-2.4.5/test/core/string/test_splice.rb

https://bitbucket.org/mediashelf/fedora-migrator
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
  1. require 'facets/string/splice'
  2. require 'test/unit'
  3. class TC_String < Test::Unit::TestCase
  4. def test_splice
  5. a = "HELLO"
  6. assert_equal( "E", a.splice(1) )
  7. assert_equal( "HLLO", a )
  8. end
  9. # This could be done if class of 2nd arg is checked.
  10. #def test_splice_length
  11. # a = "HELLO"
  12. # assert_equal( "EL", a.splice(1,2) )
  13. # assert_equal( "HLO", a )
  14. #end
  15. def test_splice_range
  16. a = "HELLO"
  17. assert_equal( "EL", a.splice(1..2) )
  18. assert_equal( "HLO", a )
  19. end
  20. def test_splice_store
  21. a = "HELLO"
  22. a.splice(1, "X")
  23. assert_equal("HXLLO", a)
  24. end
  25. end