Merge pull request #15000 from issyl0/fix-extra-blank-line-in-caveats

caveats: Remove extra blank line between `keg_only` and other caveats
This commit is contained in:
Issy Long 2023-03-19 20:57:15 +00:00 committed by GitHub
commit b979646c42
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 1 deletions

View File

@ -94,7 +94,8 @@ class Caveats
end
end
end
s << "\n"
s << "\n" unless s.end_with?("\n")
s
end
private

View File

@ -249,6 +249,32 @@ describe Caveats do
expect(caveats).to include("#{f.opt_share}/pkgconfig")
end
end
context "when joining different caveat types together" do
let(:f) do
formula do
url "foo-1.0"
keg_only "some reason"
def caveats
"something else"
end
service do
run [bin/"cmd"]
end
end
end
let(:caveats) { described_class.new(f).caveats }
it "adds the correct amount of new lines to the output" do
expect(caveats).to include("something else")
expect(caveats).to include("keg-only")
expect(caveats).to include("if you don't want/need a background service")
expect(caveats.count("\n")).to eq(9)
end
end
end
describe "shell completions" do