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

ruby-changes:65519

From: aycabta <ko1@a...>
Date: Tue, 16 Mar 2021 15:47:47 +0900 (JST)
Subject: [ruby-changes:65519] 61a29a41e1 (master): [ruby/rdoc] Allow empty .rdoc_options

https://git.ruby-lang.org/ruby.git/commit/?id=61a29a41e1

From 61a29a41e1d0d11a9963315aa86d25ed690124c0 Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Mon, 8 Mar 2021 06:14:03 +0900
Subject: [ruby/rdoc] Allow empty .rdoc_options

https://github.com/ruby/rdoc/commit/0c8cb25b50
---
 lib/rdoc/rdoc.rb            |  2 ++
 test/rdoc/test_rdoc_rdoc.rb | 11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb
index c47f639..df04646 100644
--- a/lib/rdoc/rdoc.rb
+++ b/lib/rdoc/rdoc.rb
@@ -166,6 +166,8 @@ class RDoc::RDoc https://github.com/ruby/ruby/blob/trunk/lib/rdoc/rdoc.rb#L166
     rescue Psych::SyntaxError
     end
 
+    return RDoc::Options.new if options == false # Allow empty file.
+
     raise RDoc::Error, "#{options_file} is not a valid rdoc options file" unless
       RDoc::Options === options or Hash === options
 
diff --git a/test/rdoc/test_rdoc_rdoc.rb b/test/rdoc/test_rdoc_rdoc.rb
index b54cec5..3910dd4 100644
--- a/test/rdoc/test_rdoc_rdoc.rb
+++ b/test/rdoc/test_rdoc_rdoc.rb
@@ -133,6 +133,17 @@ class TestRDocRDoc < RDoc::TestCase https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_rdoc.rb#L133
     end
   end
 
+  def test_load_options_empty_file
+    temp_dir do
+      File.open '.rdoc_options', 'w' do |io|
+      end
+
+      options = @rdoc.load_options
+
+      assert_equal 'rdoc', options.markup
+    end
+  end
+
   def test_load_options_partial_override
     temp_dir do
       File.open '.rdoc_options', 'w' do |io|
-- 
cgit v1.1


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

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