diff options
author | duerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-06 08:29:38 +0000 |
---|---|---|
committer | duerst <duerst@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-06 08:29:38 +0000 |
commit | a4ccbb63cdeb0bc42d8563011d4884510715867a (patch) | |
tree | b167ca27b973daa5d3d312e7fad0b300e6598938 /test/ruby | |
parent | c487224f48aceb3a8162680be3a1cc61e47f99c8 (diff) | |
download | ruby-a4ccbb63cdeb0bc42d8563011d4884510715867a.tar.gz |
* test/ruby/enc/test_case_comprehensive.rb: Speed up testing for small
encodings by preselecting codepoints.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55295 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/enc/test_case_comprehensive.rb | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/ruby/enc/test_case_comprehensive.rb b/test/ruby/enc/test_case_comprehensive.rb index b0618eb663..3c15084cfb 100644 --- a/test/ruby/enc/test_case_comprehensive.rb +++ b/test/ruby/enc/test_case_comprehensive.rb @@ -99,11 +99,21 @@ class TestComprehensiveCaseFold < Test::Unit::TestCase end def self.generate_casefold_tests (encoding) + all_tests + # preselect codepoints to speed up testing for small encodings + codepoints = @@codepoints.select do |code| + begin + code.encode(encoding) + true + rescue Encoding::UndefinedConversionError + false + end + end all_tests.each do |test| attributes = test.attributes.map(&:to_s).join '-' attributes.prepend '_' unless attributes.empty? define_method "test_#{encoding}_#{test.method_name}#{attributes}" do - @@codepoints.each do |code| + codepoints.each do |code| begin source = code.encode(encoding) * 5 target = test.first_data[code].encode(encoding) + test.follow_data[code].encode(encoding) * 4 |