Sha256: 6b1b60603a4333411fa4afff18212419dcb7757ca575dfee8dc36e3483cfcfe1

Contents?: true

Size: 1.47 KB

Versions: 1

Compression:

Stored size: 1.47 KB

Contents

#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
# for lib/facets/core/string/word_wrap.rb
#
# Extracted Tue Jun 06 09:30:19 EDT 2006
# Unit Tools Reap Test Extractor
#

require 'facets/core/string/word_wrap.rb'


  require 'test/unit'

  class TCString < Test::Unit::TestCase

    def test_word_wrap
      assert_equal "abcde\n12345\nxyzwu\n", "abcde 12345 xyzwu".word_wrap(5)
      assert_equal "abcd\n1234\nxyzw\n", "abcd 1234 xyzw".word_wrap(4)
      assert_equal "abc\n123\n", "abc 123".word_wrap(4)
      assert_equal "abc \n123\n", "abc  123".word_wrap(4)
      assert_equal "abc \n123\n", "abc     123".word_wrap(4)
    end

    def test_word_wrap!
      w = "abcde 12345 xyzwu" ; w.word_wrap!(5)
      assert_equal("abcde\n12345\nxyzwu\n", w)
      w = "abcd 1234 xyzw" ; w.word_wrap!(4)
      assert_equal("abcd\n1234\nxyzw\n", w)
      w = "abc 123" ; w.word_wrap!(4)
      assert_equal "abc\n123\n", w
      w = "abc  123" ; w.word_wrap!(4)
      assert_equal("abc \n123\n", w)
      w = "abc     123" ; w.word_wrap!(4)
      assert_equal("abc \n123\n", w)
    end

#   def test_word_wrap
#     assert_equal "abcde-\n12345-\nxyzwu\n", "abcde12345xyzwu".word_wrap(6,2)
#     assert_equal "abcd-\n1234-\nxyzw\n", "abcd1234xyzw".word_wrap(5,2)
#     assert_equal "abc \n123\n", "abc 123".word_wrap(4,2)
#     assert_equal "abc \n123\n", "abc  123".word_wrap(4,2)
#     assert_equal "abc \n123\n", "abc     123".word_wrap(4,2)
#   end

  end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
facets-1.4.1 test/lib/facets/core/string/test_word_wrap.rb