diff --git a/lib/hoe.rb b/lib/hoe.rb index 9059426..472c0ae 100644 --- a/lib/hoe.rb +++ b/lib/hoe.rb @@ -676,6 +676,8 @@ def intuit_values input .map(&:last) .each_slice(2) .to_h { |k, v| + raise "No body for %p section" % [k[0].strip] \ + unless v kp = k.map { |s| s.strip.chomp(":").sub(/(?:=+|#+)\s*/, '').downcase }.join("\n") diff --git a/test/test_hoe.rb b/test/test_hoe.rb index 7b996cd..4b81642 100644 --- a/test/test_hoe.rb +++ b/test/test_hoe.rb @@ -171,6 +171,20 @@ def test_initialize_intuit_ambiguous end end + def test_initialize_intuit__empty + Dir.mktmpdir do |path| + Dir.chdir path do + File.write "README.rdoc", "= blah\n" + + e = assert_raises RuntimeError do + hoe + end + + assert_equal "No body for \"= blah\" section", e.message + end + end + end + def test_file_read_utf Tempfile.open "BOM" do |io| io.write "\xEF\xBB\xBFBOM"