summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLars Kanis <lars@greiz-reinsdorf.de>2020-11-22 14:23:40 +0100
committerGitHub <noreply@github.com>2020-11-22 22:23:40 +0900
commitd403591b34e204a5937241025c62c877e579fbaf (patch)
tree2ba3966f5c792f74ed0f7873ea8f1def8efa63f3 /test
parent2d112c346a7a1369af1236928538a3b3a833f781 (diff)
downloadruby-d403591b34e204a5937241025c62c877e579fbaf.tar.gz
Add string encoding IBM720 alias CP720 (#3803)
The mapping table is generated from the ICU project: https://github.com/unicode-org/icu/blob/master/icu4c/source/data/mappings/ibm-720_P100-1997.ucm Fixes bug 16233 : https://bugs.ruby-lang.org/issues/16233
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_transcode.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ruby/test_transcode.rb b/test/ruby/test_transcode.rb
index 0f6b787fa1..04c8248697 100644
--- a/test/ruby/test_transcode.rb
+++ b/test/ruby/test_transcode.rb
@@ -469,6 +469,25 @@ class TestTranscode < Test::Unit::TestCase
check_both_ways("\u00A0", "\xFF", 'IBM437') # non-breaking space
end
+ def test_IBM720
+ assert_raise(Encoding::UndefinedConversionError) { "\x80".encode("utf-8", 'IBM720') }
+ assert_raise(Encoding::UndefinedConversionError) { "\x8F".encode("utf-8", 'IBM720') }
+ assert_raise(Encoding::UndefinedConversionError) { "\x90".encode("utf-8", 'IBM720') }
+ check_both_ways("\u0627", "\x9F", 'IBM720') # ا
+ check_both_ways("\u0628", "\xA0", 'IBM720') # ب
+ check_both_ways("\u00BB", "\xAF", 'IBM720') # »
+ check_both_ways("\u2591", "\xB0", 'IBM720') # ░
+ check_both_ways("\u2510", "\xBF", 'IBM720') # ┐
+ check_both_ways("\u2514", "\xC0", 'IBM720') # └
+ check_both_ways("\u2567", "\xCF", 'IBM720') # ╧
+ check_both_ways("\u2568", "\xD0", 'IBM720') # ╨
+ check_both_ways("\u2580", "\xDF", 'IBM720') # ▀
+ check_both_ways("\u0636", "\xE0", 'IBM720') # ض
+ check_both_ways("\u064A", "\xEF", 'IBM720') # ي
+ check_both_ways("\u2261", "\xF0", 'IBM720') # ≡
+ check_both_ways("\u00A0", "\xFF", 'IBM720') # non-breaking space
+ end
+
def test_IBM775
check_both_ways("\u0106", "\x80", 'IBM775') # Ć
check_both_ways("\u00C5", "\x8F", 'IBM775') # Å