diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-28 08:31:28 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-08-28 08:31:28 +0000 |
commit | c5da5b1ea27ec693dd09e9d586e913da1d5ba4b6 (patch) | |
tree | 8624c192a757d272b5ebae46dd9691b7994da0c5 /test/rubygems/test_gem_text.rb | |
parent | 1a1930180c66b291c89d486b984f8bf5237d6918 (diff) | |
download | ruby-c5da5b1ea27ec693dd09e9d586e913da1d5ba4b6.tar.gz |
Merge rubygems-2.6.13.
see details for this update:
http://blog.rubygems.org/2017/08/27/2.6.13-released.html
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_text.rb')
-rw-r--r-- | test/rubygems/test_gem_text.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/rubygems/test_gem_text.rb b/test/rubygems/test_gem_text.rb index a6e22e04da..04f3f605e8 100644 --- a/test/rubygems/test_gem_text.rb +++ b/test/rubygems/test_gem_text.rb @@ -36,6 +36,10 @@ Without the wrapping, the text might not look good in the RSS feed. assert_equal expected, format_text(text, 78) end + def test_format_removes_nonprintable_characters + assert_equal "text with weird .. stuff .", format_text("text with weird \x1b\x02 stuff \x7f", 40) + end + def test_min3 assert_equal 1, min3(1, 1, 1) assert_equal 1, min3(1, 1, 2) @@ -74,4 +78,11 @@ Without the wrapping, the text might not look good in the RSS feed. assert_equal 7, levenshtein_distance("xxxxxxx", "ZenTest") assert_equal 7, levenshtein_distance("zentest", "xxxxxxx") end + + def test_truncate_text + assert_equal "abc", truncate_text("abc", "desc") + assert_equal "Truncating desc to 2 characters:\nab", truncate_text("abc", "desc", 2) + s = "ab" * 500_001 + assert_equal "Truncating desc to 1,000,000 characters:\n#{s[0, 1_000_000]}", truncate_text(s, "desc", 1_000_000) + end end |