You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
assert_equal('...is a beautiful! mor...',excerpt('This is a beautiful! morning','beautiful',5))
233
-
assert_equal('...is a beautiful? mor...',excerpt('This is a beautiful? morning','beautiful',5))
240
+
assert_equal('...is a beautiful! mor...',excerpt('This is a beautiful! morning','beautiful',:radius=>5))
241
+
assert_equal('...is a beautiful? mor...',excerpt('This is a beautiful? morning','beautiful',:radius=>5))
234
242
end
235
243
236
-
deftest_excerpt_with_options_hash
237
-
assert_equal("...is a beautiful morn...",excerpt("This is a beautiful morning","beautiful",:radius=>5))
244
+
deftest_excerpt_with_omission
238
245
assert_equal("[...]is a beautiful morn[...]",excerpt("This is a beautiful morning","beautiful",:omission=>"[...]",:radius=>5))
239
246
assert_equal(
240
247
"This is the ultimate supercalifragilisticexpialidoceous very looooooooooooooooooong looooooooooooong beautiful morning with amazing sunshine and awesome tempera[...]",
assert_equal("...\357\254\203ciency could not be...",excerpt("That's why e\357\254\203ciency could not be helped",'could',8))
256
+
assert_equal("...\357\254\203ciency could not be...",excerpt("That's why e\357\254\203ciency could not be helped",'could',:line_width=>8))
250
257
end
251
258
with_kcode('none')do
252
-
assert_equal("...\203ciency could not be...",excerpt("That's why e\357\254\203ciency could not be helped",'could',8))
259
+
assert_equal("...\203ciency could not be...",excerpt("That's why e\357\254\203ciency could not be helped",'could',:line_width=>8))
253
260
end
254
261
end
255
262
else
256
263
deftest_excerpt_with_utf8
257
-
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))
264
+
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))
258
265
# .mb_chars always returns UTF-8, even in 1.9. This is not great, but it's how it works. Let's work this out.
259
266
# assert_equal("...\203ciency could not be...", excerpt("That's why e\357\254\203ciency could not be helped".force_encoding("BINARY"), 'could', 8))
260
267
end
261
268
end
262
269
263
270
deftest_word_wrap
264
-
assert_equal("my very very\nvery long\nstring",word_wrap("my very very very long string",15))
271
+
assert_equal("my very very\nvery long\nstring",word_wrap("my very very very long string",:line_width=>15))
265
272
end
266
-
267
-
deftest_word_wrap_with_extra_newlines
268
-
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))
273
+
274
+
deftest_word_wrap_old_api_is_depcrecated
275
+
assert_deprecated("Calling word_wrap with line_width as an argument is deprecated. Please call with :line_width => 15 instead.")do
276
+
word_wrap("my very very very long string",15)
277
+
end
269
278
end
270
279
271
-
deftest_word_wrap_with_options_hash
272
-
assert_equal("my very very\nvery long\nstring",word_wrap("my very very very long string",:line_width=>15))
280
+
deftest_word_wrap_with_extra_newlines
281
+
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))
0 commit comments