on_os block: test support for patches

This commit is contained in:
Michka Popoff 2020-06-08 23:23:42 +02:00
parent 2a50ef045f
commit 3ad9009937
2 changed files with 9 additions and 25 deletions

View File

@ -67,27 +67,19 @@ describe Formula do
sha256 TEST_SHA256
patch do
url "patch_both"
end
on_macos do
patch do
on_macos do
url "patch_macos"
end
end
on_linux do
patch do
on_linux do
url "patch_linux"
end
end
end
expect(f.patchlist.length).to eq(2)
expect(f.patchlist.length).to eq(1)
expect(f.patchlist.first.strip).to eq(:p1)
expect(f.patchlist.first.url).to eq("patch_both")
expect(f.patchlist.second.strip).to eq(:p1)
expect(f.patchlist.second.url).to eq("patch_linux")
expect(f.patchlist.first.url).to eq("patch_linux")
end
end

View File

@ -66,7 +66,7 @@ describe Formula do
end
describe "#on_macos" do
it "adds a patch on macos only" do
it "adds a patch on Mac only" do
f = formula do
homepage "https://brew.sh"
@ -74,27 +74,19 @@ describe Formula do
sha256 TEST_SHA256
patch do
url "patch_both"
end
on_macos do
patch do
on_macos do
url "patch_macos"
end
end
on_linux do
patch do
on_linux do
url "patch_linux"
end
end
end
expect(f.patchlist.length).to eq(2)
expect(f.patchlist.length).to eq(1)
expect(f.patchlist.first.strip).to eq(:p1)
expect(f.patchlist.first.url).to eq("patch_both")
expect(f.patchlist.second.strip).to eq(:p1)
expect(f.patchlist.second.url).to eq("patch_macos")
expect(f.patchlist.first.url).to eq("patch_macos")
end
end