diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-28 06:56:50 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-06-28 06:56:50 +0000 |
commit | 023aaa51a20cb4e0dc92daa4d2197741bcf8bd6c (patch) | |
tree | a80b72df76cf2c1aceec06564c3d219168cdeb40 /test/test_unicode_normalize.rb | |
parent | 5026a663ab3e01600131b9bd84c672548a1cd3d8 (diff) |
Skip unavailable tests
* test/ruby/enc/test_case_comprehensive.rb: noting to test if
Unicode data files are available.
[ruby-core:76160] [Bug #12433]
* test/test_unicode_normalize.rb: ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/test_unicode_normalize.rb')
-rw-r--r-- | test/test_unicode_normalize.rb | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/test/test_unicode_normalize.rb b/test/test_unicode_normalize.rb index 211f8f5430..be1bf5f49b 100644 --- a/test/test_unicode_normalize.rb +++ b/test/test_unicode_normalize.rb @@ -11,15 +11,24 @@ class TestUnicodeNormalize < Test::Unit::TestCase UNICODE_VERSION = UnicodeNormalize::UNICODE_VERSION UNICODE_DATA_PATH = "../enc/unicode/data/#{UNICODE_VERSION}" - def expand_filename(basename) + def self.expand_filename(basename) File.expand_path("#{UNICODE_DATA_PATH}/#{basename}.txt", __dir__) end +end +%w[NormalizationTest].all? {|f| + File.exist?(TestUnicodeNormalize.expand_filename(f)) +} and +class TestUnicodeNormalize NormTest = Struct.new :source, :NFC, :NFD, :NFKC, :NFKD, :line - def read_tests - IO.readlines(expand_filename('NormalizationTest'), encoding: 'utf-8') - .tap { |lines| assert_include(lines[0], "NormalizationTest-#{UNICODE_VERSION}.txt")} + def self.read_tests + lines = IO.readlines(expand_filename('NormalizationTest'), encoding: 'utf-8') + firstline = lines.shift + define_method "test_0_normalizationtest_firstline" do + assert_include(firstline, "NormalizationTest-#{UNICODE_VERSION}.txt") + end + lines .collect.with_index { |linedata, linenumber| [linedata, linenumber]} .reject { |line| line[0] =~ /^[\#@]/ } .collect do |line| @@ -33,7 +42,7 @@ class TestUnicodeNormalize < Test::Unit::TestCase string.codepoints.collect { |cp| cp.to_s(16).upcase.rjust(4, '0') } end - def setup + begin @@tests ||= read_tests rescue Errno::ENOENT => e @@tests ||= [] @@ -137,11 +146,6 @@ class TestUnicodeNormalize < Test::Unit::TestCase generate_test_check_false :NFD, :NFKC, :nfkc generate_test_check_false :NFKD, :NFKC, :nfkc - def test_AAAAA_data_file_available # AAAAA makes sure this test is run first - expanded = expand_filename 'NormalizationTest' - assert File.exist?(expanded), "File #{expanded} missing." - end - def test_non_UTF_8 assert_equal "\u1E0A".encode('UTF-16BE'), "D\u0307".encode('UTF-16BE').unicode_normalize(:nfc) assert_equal true, "\u1E0A".encode('UTF-16BE').unicode_normalized?(:nfc) |