Ensure empty message values are properly formatted
This commit is contained in:
parent
783f5fc65d
commit
318dca294a
|
@ -329,12 +329,15 @@ module Vagrant
|
|||
target = opts[:target] if opts.key?(:target)
|
||||
target = "#{target}:" if target != ""
|
||||
|
||||
lines = [].tap do |l|
|
||||
message.scan(/(.*?)(\n|$)/).each do |m|
|
||||
l << m.first if m.first != "" || (m.first == "" && m.last == "\n")
|
||||
lines = [message]
|
||||
if message != ""
|
||||
lines = [].tap do |l|
|
||||
message.scan(/(.*?)(\n|$)/).each do |m|
|
||||
l << m.first if m.first != "" || (m.first == "" && m.last == "\n")
|
||||
end
|
||||
end
|
||||
lines << "" if message.end_with?("\n")
|
||||
end
|
||||
lines << "" if message.end_with?("\n")
|
||||
|
||||
# Otherwise, make sure to prefix every line properly
|
||||
lines.map do |line|
|
||||
|
|
|
@ -413,5 +413,10 @@ describe Vagrant::UI::Prefixed do
|
|||
expect(subject.format_message(:detail, msg).count("\n")).to eq(msg.count("\n"))
|
||||
end
|
||||
end
|
||||
|
||||
it "should properly format a blank message" do
|
||||
expect(subject.format_message(:detail, "", target: "default", prefix: true)).
|
||||
to match(/\s+default:\s+/)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue