assert_equal('...is a beautiful! mor...',excerpt('This is a beautiful! morning','beautiful',5))
assert_equal('...is a beautiful? mor...',excerpt('This is a beautiful? morning','beautiful',5))
assert_equal('...is a beautiful! mor...',excerpt('This is a beautiful! morning','beautiful',:radius=>5))
assert_equal('...is a beautiful? mor...',excerpt('This is a beautiful? morning','beautiful',:radius=>5))
end
deftest_excerpt_with_options_hash
assert_equal("...is a beautiful morn...",excerpt("This is a beautiful morning","beautiful",:radius=>5))
deftest_excerpt_with_omission
assert_equal("[...]is a beautiful morn[...]",excerpt("This is a beautiful morning","beautiful",:omission=>"[...]",:radius=>5))
assert_equal(
"This is the ultimate supercalifragilisticexpialidoceous very looooooooooooooooooong looooooooooooong beautiful morning with amazing sunshine and awesome tempera[...]",
assert_equal("...\357\254\203ciency could not be...".force_encoding('UTF-8'),excerpt("That's why e\357\254\203ciency could not be helped".force_encoding('UTF-8'),'could',8))
assert_equal("...\357\254\203ciency could not be...".force_encoding('UTF-8'),excerpt("That's why e\357\254\203ciency could not be helped".force_encoding('UTF-8'),'could',:radius=>8))
end
deftest_word_wrap
assert_equal("my very very\nvery long\nstring",word_wrap("my very very very long string",15))
assert_equal("my very very\nvery long\nstring",word_wrap("my very very very long string",:line_width=>15))
end
deftest_word_wrap_with_extra_newlines
assert_equal("my very very\nvery long\nstring\n\nwith another\nline",word_wrap("my very very very long string\n\nwith another line",15))
end
deftest_word_wrap_with_options_hash
assert_equal("my very very\nvery long\nstring",word_wrap("my very very very long string",:line_width=>15))
assert_equal("my very very\nvery long\nstring\n\nwith another\nline",word_wrap("my very very very long string\n\nwith another line",:line_width=>15))