1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/rdoc/parser.rb (RDoc.binary?): fix wrong regexp.

[ruby-core:44798] [Bug #6393]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35534 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2012-05-03 22:20:26 +00:00
parent c327407bdc
commit 8109c530b2
3 changed files with 9 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Fri May 4 07:19:02 2012 NARUSE, Yui <naruse@ruby-lang.org>
* lib/rdoc/parser.rb (RDoc.binary?): fix wrong regexp.
[ruby-core:44798] [Bug #6393]
Fri May 4 01:33:20 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/rdoc/parser.rb (RDoc.alias_extension): a real file is irrelevant

View file

@ -85,7 +85,7 @@ class RDoc::Parser
if have_encoding then
mode = "r"
s.sub!(/\A#!.*\n/, '') # assume shebang line isn't longer than 1024.
encoding = s[/^\s*\#\s*(?:-\*-\s*)?(?:en)?coding:\s*\([^\s;]+?\)(?:-\*-)?/, 1]
encoding = s[/^\s*\#\s*(?:-\*-\s*)?(?:en)?coding:\s*([^\s;]+?)(?:-\*-|[\s;])/, 1]
mode = "r:#{encoding}" if encoding
s = File.open(file, mode) {|f| f.gets(nil, 1024)}

View file

@ -29,8 +29,11 @@ class TestRDocParser < MiniTest::Unit::TestCase
end
def test_class_binary_large_japanese_rdoc
extenc, Encoding.default_external = Encoding.default_external, Encoding::US_ASCII
file_name = File.expand_path '../test.ja.largedoc', __FILE__
assert !@RP.binary?(file_name)
ensure
Encoding.default_external = extenc
end
def test_class_binary_japanese_rdoc