Skip to content

Commit

Permalink
+ Raise error if readme file is improperly structured.
Browse files Browse the repository at this point in the history
[git-p4: depot-paths = "//src/hoe/dev/": change = 14124]
  • Loading branch information
zenspider committed Apr 22, 2024
1 parent 8b8a97e commit bf26ed2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/hoe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
14 changes: 14 additions & 0 deletions test/test_hoe.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit bf26ed2

Please sign in to comment.