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

ruby-changes:21853

From: usa <ko1@a...>
Date: Wed, 30 Nov 2011 09:13:15 +0900 (JST)
Subject: [ruby-changes:21853] usa:r33902 (trunk): * lib/rdoc/encoding.rb (RDoc::Encoding.read_file): fixup newline chars

usa	2011-11-30 09:13:02 +0900 (Wed, 30 Nov 2011)

  New Revision: 33902

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33902

  Log:
    * lib/rdoc/encoding.rb (RDoc::Encoding.read_file): fixup newline chars
      on Windows.
      see https://github.com/rdoc/rdoc/issues/87
    
    * test/rdoc/test_rdoc_markup_pre_process.rb
      (TestRDocMarkupPreProcess#test_include_file, 
      TestRDocMarkupPreProcess#test_include_file_encoding_incompatible):
      follow above change.

  Modified files:
    trunk/ChangeLog
    trunk/lib/rdoc/encoding.rb
    trunk/test/rdoc/test_rdoc_markup_pre_process.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 33901)
+++ ChangeLog	(revision 33902)
@@ -1,3 +1,14 @@
+Wed Nov 30 09:12:43 2011  NAKAMURA Usaku  <usa@r...>
+
+	* lib/rdoc/encoding.rb (RDoc::Encoding.read_file): fixup newline chars
+	  on Windows.
+	  see https://github.com/rdoc/rdoc/issues/87
+
+	* test/rdoc/test_rdoc_markup_pre_process.rb
+	  (TestRDocMarkupPreProcess#test_include_file, 
+	  TestRDocMarkupPreProcess#test_include_file_encoding_incompatible):
+	  follow above change.
+
 Wed Nov 30 09:09:37 2011  Aaron Patterson <aaron@t...>
 
 	* ext/psych/parser.c (parse): parse method can take an option file
Index: lib/rdoc/encoding.rb
===================================================================
--- lib/rdoc/encoding.rb	(revision 33901)
+++ lib/rdoc/encoding.rb	(revision 33902)
@@ -20,6 +20,7 @@
 
   def self.read_file filename, encoding, force_transcode = false
     content = open filename, "rb" do |f| f.read end
+    content.gsub!("\r\n", "\n") if RUBY_PLATFORM =~ /mswin|mingw/
 
     utf8 = content.sub!(/\A\xef\xbb\xbf/, '')
 
Index: test/rdoc/test_rdoc_markup_pre_process.rb
===================================================================
--- test/rdoc/test_rdoc_markup_pre_process.rb	(revision 33901)
+++ test/rdoc/test_rdoc_markup_pre_process.rb	(revision 33902)
@@ -43,11 +43,6 @@
 contents of a string.
     EXPECTED
 
-    # FIXME 1.9 fix on windoze
-    # preprocessor uses binread, so line endings are \r\n
-    expected.gsub!("\n", "\r\n") if
-      RUBY_VERSION < "1.9.3" && RUBY_PLATFORM =~ /mswin|mingw/
-
     assert_equal expected, content
   end
 
@@ -67,11 +62,6 @@
 
     expected = "?\n"
 
-    # FIXME 1.9 fix on windoze
-    # preprocessor uses binread, so line endings are \r\n
-    expected.gsub!("\n", "\r\n") if
-      RUBY_VERSION < "1.9.3" && RUBY_PLATFORM =~ /mswin|mingw/
-
     assert_equal expected, content
   end
 

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

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