Sha256: cca78f02fa9deb6429aa594900742a735072a928877361d2cf57d7acc4a6c8f1

Contents?: true

Size: 1.02 KB

Versions: 16

Compression:

Stored size: 1.02 KB

Contents

require 'facets/string/cleave.rb'
require 'test/unit'

class TestStringWords < Test::Unit::TestCase

  def test_cleave_nospaces
    assert_equal [ 'whole', '' ], 'whole'.cleave
    assert_equal [ 'Supercalifragilisticexpialidocious', '' ],
                'Supercalifragilisticexpialidocious'.cleave
  end

  def test_cleave_exact_middle
    assert_equal [ 'fancy', 'split' ], 'fancy split'.cleave
    assert_equal [ 'All good Rubyists', 'know how to party' ],
                'All good Rubyists know how to party'.cleave
  end

  def test_cleave_closer_to_start
    assert_equal [ 'short', 'splitter' ], 'short splitter'.cleave
    assert_equal [ 'Four score and', 'seven years ago...' ],
                'Four score and seven years ago...'.cleave
    assert_equal [ 'abc def', 'ghijklm nop' ],
                'abc def ghijklm nop'.cleave
  end

  def test_cleave_closer_to_end
    assert_equal [ 'extended', 'split' ], 'extended split'.cleave
    assert_equal [ 'abc defghi', 'jklm nop' ],
                'abc defghi jklm nop'.cleave
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

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