Merge pull request #3506 from MikeMcQuaid/cleaner_spec_os

cleaner_spec: have a single "cleans files" test.
This commit is contained in:
Mike McQuaid 2017-11-30 09:30:10 +00:00 committed by GitHub
commit 3d96cd156a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 23 deletions

View File

@ -12,30 +12,29 @@ describe Cleaner do
end end
describe "#clean" do describe "#clean" do
it "cleans files", :needs_macos do it "cleans files" do
f.bin.mkpath f.bin.mkpath
f.lib.mkpath f.lib.mkpath
cp "#{TEST_FIXTURE_DIR}/mach/a.out", f.bin
cp Dir["#{TEST_FIXTURE_DIR}/mach/*.dylib"], f.lib if OS.mac?
cp "#{TEST_FIXTURE_DIR}/mach/a.out", f.bin
cp Dir["#{TEST_FIXTURE_DIR}/mach/*.dylib"], f.lib
elsif OS.linux?
cp "#{TEST_FIXTURE_DIR}/elf/hello", f.bin
cp Dir["#{TEST_FIXTURE_DIR}/elf/libhello.so.0"], f.lib
end
subject.clean subject.clean
expect((f.bin/"a.out").stat.mode).to eq(0100555) if OS.mac?
expect((f.lib/"fat.dylib").stat.mode).to eq(0100444) expect((f.bin/"a.out").stat.mode).to eq(0100555)
expect((f.lib/"x86_64.dylib").stat.mode).to eq(0100444) expect((f.lib/"fat.dylib").stat.mode).to eq(0100444)
expect((f.lib/"i386.dylib").stat.mode).to eq(0100444) expect((f.lib/"x86_64.dylib").stat.mode).to eq(0100444)
end expect((f.lib/"i386.dylib").stat.mode).to eq(0100444)
elsif OS.linux?
it "cleans files", :needs_linux do expect((f.bin/"hello").stat.mode).to eq(0100555)
f.bin.mkpath expect((f.lib/"libhello.so.0").stat.mode).to eq(0100555)
f.lib.mkpath end
cp "#{TEST_FIXTURE_DIR}/elf/hello", f.bin
cp Dir["#{TEST_FIXTURE_DIR}/elf/libhello.so.0"], f.lib
subject.clean
expect((f.bin/"hello").stat.mode).to eq(0100555)
expect((f.lib/"libhello.so.0").stat.mode).to eq(0100555)
end end
it "prunes the prefix if it is empty" do it "prunes the prefix if it is empty" do

View File

@ -61,10 +61,6 @@ RSpec.configure do |config|
skip "Needs official command Taps." unless ENV["HOMEBREW_TEST_OFFICIAL_CMD_TAPS"] skip "Needs official command Taps." unless ENV["HOMEBREW_TEST_OFFICIAL_CMD_TAPS"]
end end
config.before(:each, :needs_linux) do
skip "Not on Linux." unless OS.linux?
end
config.before(:each, :needs_macos) do config.before(:each, :needs_macos) do
skip "Not on macOS." unless OS.mac? skip "Not on macOS." unless OS.mac?
end end