Sha256: 44483b8cac2c844acac16ea2eaa0ea23619dc9585e3e560cdce0440f2feb964b

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

covers 'facets/string/cleave'

testcase String do

  table = [
    [ 'no spaces short word'    , 'whole'                              , ['whole', ''] ],
    [ 'no spaces long word'     , 'Supercalifragilisticexpialidocious' , ['Supercalifragilisticexpialidocious', ''] ],
    [ 'exact middle two words'  , 'fancy split'                        , ['fancy', 'split'] ],
    [ 'exact middle many words' , 'All good Rubyists know how to party', ['All good Rubyists', 'know how to party'] ],
    [ 'closer to start'         , 'short splitter'                     , ['short', 'splitter'] ],
    [ 'closer to start'         , 'Four score and seven years ago...'  , ['Four score and', 'seven years ago...'] ],
    [ 'closer to start'         , 'abc def ghijklm nop'                , ['abc def', 'ghijklm nop'] ],
    [ 'closer to end'           , 'extended split'                     , ['extended', 'split'] ],
    [ 'closer to end'           , 'abc defghi jklm nop'                , [ 'abc defghi', 'jklm nop'] ]
  ]

  table.each do |d, s, x|
    unit :cleave => d do
      s.cleave.assert == x
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
facets-2.9.1 test/core/string/test_cleave.rb
facets-2.9.0 test/core/string/test_cleave.rb
facets-2.9.0.pre.2 test/core/string/test_cleave.rb
facets-2.9.0.pre.1 test/core/string/test_cleave.rb