[前][次][番号順一覧][スレッド一覧]

ruby-changes:43119

From: duerst <ko1@a...>
Date: Sat, 28 May 2016 19:08:43 +0900 (JST)
Subject: [ruby-changes:43119] duerst:r55193 (trunk): * test/ruby/enc/test_case_comprehensive.rb: Add error messages to tests

duerst	2016-05-28 19:08:37 +0900 (Sat, 28 May 2016)

  New Revision: 55193

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=55193

  Log:
    * test/ruby/enc/test_case_comprehensive.rb: Add error messages to tests
      for data file availability; refactoring.

  Modified files:
    trunk/ChangeLog
    trunk/test/ruby/enc/test_case_comprehensive.rb
Index: test/ruby/enc/test_case_comprehensive.rb
===================================================================
--- test/ruby/enc/test_case_comprehensive.rb	(revision 55192)
+++ test/ruby/enc/test_case_comprehensive.rb	(revision 55193)
@@ -21,8 +21,12 @@ class TestComprehensiveCaseFold < Test:: https://github.com/ruby/ruby/blob/trunk/test/ruby/enc/test_case_comprehensive.rb#L21
     s.split(' ').map { |c| c.to_i(16) }.pack('U*')
   end
 
+  def self.expand_filename(basename)
+    File.expand_path("#{UNICODE_DATA_PATH}/#{basename}.txt", __dir__)
+  end
+
   def self.read_data_file (filename)
-    IO.readlines(File.expand_path("#{UNICODE_DATA_PATH}/#{filename}.txt", __dir__), encoding: Encoding::ASCII_8BIT)
+    IO.readlines(expand_filename(filename), encoding: Encoding::ASCII_8BIT)
     .tap do |lines|
            raise "File Version Mismatch" unless filename=='UnicodeData' or /#{filename}-#{UNICODE_VERSION}\.txt/ =~ lines[0]
          end
@@ -113,10 +117,13 @@ class TestComprehensiveCaseFold < Test:: https://github.com/ruby/ruby/blob/trunk/test/ruby/enc/test_case_comprehensive.rb#L117
     end
   end
 
-  def test_AAAAA_data_files_available
-    assert File.exist? File.expand_path("#{UNICODE_DATA_PATH}/UnicodeData.txt", __dir__)
-    assert File.exist? File.expand_path("#{UNICODE_DATA_PATH}/CaseFolding.txt", __dir__)
-    assert File.exist? File.expand_path("#{UNICODE_DATA_PATH}/SpecialCasing.txt", __dir__)
+  def check_file_available(filename)
+    expanded = self.class.expand_filename(filename) 
+    assert File.exist?(expanded), "File #{expanded} missing."
+  end
+
+  def test_AAAAA_data_files_available   # AAAAA makes sure this test is run first
+    %w[UnicodeData CaseFolding SpecialCasing].each { |f| check_file_available f }
   end
 
   generate_casefold_tests 'US-ASCII'
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 55192)
+++ ChangeLog	(revision 55193)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat May 28 19:08:36 2016  Martin Duerst  <duerst@i...>
+
+	* test/ruby/enc/test_case_comprehensive.rb: Add error messages to tests
+	  for data file availability; refactoring.
+
 Sat May 28 14:00:10 2016  Kazuki Yamaguchi  <k@r...>
 
 	* ext/openssl/lib/openssl/ssl.rb (SSLSocket): Move the implementation of

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]