PageRenderTime 141ms CodeModel.GetById 43ms RepoModel.GetById 8ms app.codeStats 0ms

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

https://bitbucket.org/mediashelf/fedora-migrator
Ruby | 32 lines | 26 code | 6 blank | 0 comment | 0 complexity | 5611201b4d9b7d2dbf4e34876c5a7404 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/cleave.rb'
  2. require 'test/unit'
  3. class TestStringWords < Test::Unit::TestCase
  4. def test_cleave_nospaces
  5. assert_equal [ 'whole', '' ], 'whole'.cleave
  6. assert_equal [ 'Supercalifragilisticexpialidocious', '' ],
  7. 'Supercalifragilisticexpialidocious'.cleave
  8. end
  9. def test_cleave_exact_middle
  10. assert_equal [ 'fancy', 'split' ], 'fancy split'.cleave
  11. assert_equal [ 'All good Rubyists', 'know how to party' ],
  12. 'All good Rubyists know how to party'.cleave
  13. end
  14. def test_cleave_closer_to_start
  15. assert_equal [ 'short', 'splitter' ], 'short splitter'.cleave
  16. assert_equal [ 'Four score and', 'seven years ago...' ],
  17. 'Four score and seven years ago...'.cleave
  18. assert_equal [ 'abc def', 'ghijklm nop' ],
  19. 'abc def ghijklm nop'.cleave
  20. end
  21. def test_cleave_closer_to_end
  22. assert_equal [ 'extended', 'split' ], 'extended split'.cleave
  23. assert_equal [ 'abc defghi', 'jklm nop' ],
  24. 'abc defghi jklm nop'.cleave
  25. end
  26. end