# File ../../../../../test/test_textutils.rb, line 7 def setup @tu_nil = Object.new @tu_nil.extend ReVIEW::TextUtils def @tu_nil.pre_paragraph nil end def @tu_nil.post_paragraph nil end @tu_p = Object.new @tu_p.extend ReVIEW::TextUtils def @tu_p.pre_paragraph '<p>' end def @tu_p.post_paragraph '</p>' end end
# File ../../../../../test/test_textutils.rb, line 29 def test_detab detabed = detab("\t\tabc") assert_equal ' abc', detabed detabed = detab("\tabc\tbcd") assert_equal ' abc bcd', detabed end
# File ../../../../../test/test_textutils.rb, line 36 def test_detab_with_arg detabed = detab("\t\tabcd\tef", 2) assert_equal ' abcd ef', detabed detabed = detab("\tabc\tdef", 4) assert_equal ' abc def', detabed end
# File ../../../../../test/test_textutils.rb, line 43 def test_split_paragraph_empty_nil ret = @tu_nil.split_paragraph([]) assert_equal ret, [''] end
# File ../../../../../test/test_textutils.rb, line 48 def test_split_paragraph_empty_p ret = @tu_p.split_paragraph([]) assert_equal ret, ['<p></p>'] end
# File ../../../../../test/test_textutils.rb, line 66 def test_split_paragraph_nil ret = @tu_nil.split_paragraph(['abc']) assert_equal ['abc'], ret ret = @tu_nil.split_paragraph(['abc', 'def']) assert_equal ['abcdef'], ret ret = @tu_nil.split_paragraph(['abc', '', 'def']) assert_equal ['abc', 'def'], ret ret = @tu_nil.split_paragraph(['abc', '', '', 'def']) assert_equal ['abc', 'def'], ret ret = @tu_nil.split_paragraph(['abc', '', '', 'def', 'ghi']) assert_equal ['abc', 'defghi'], ret end
# File ../../../../../test/test_textutils.rb, line 53 def test_split_paragraph_p ret = @tu_p.split_paragraph(['abc']) assert_equal ['<p>abc</p>'], ret ret = @tu_p.split_paragraph(['abc', 'def']) assert_equal ['<p>abcdef</p>'], ret ret = @tu_p.split_paragraph(['abc', '', 'def']) assert_equal ['<p>abc</p>', '<p>def</p>'], ret ret = @tu_p.split_paragraph(['abc', '', '', 'def']) assert_equal ['<p>abc</p>', '<p>def</p>'], ret ret = @tu_p.split_paragraph(['abc', '', '', 'def', 'ghi']) assert_equal ['<p>abc</p>', '<p>defghi</p>'], ret end