aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/utils
diff options
context:
space:
mode:
authorNaoto Kaneko2017-02-27 14:23:53 +0900
committerNaoto Kaneko2017-02-27 14:23:53 +0900
commit928eaca26720fd38b07c1e7df3f9f567477d48db (patch)
treec08fd030cca960e74bab72b59ce057684e554334 /Library/Homebrew/test/utils
parentccc9b2dc6dc27026673db3c8871c691be9541342 (diff)
parente3f4701f385c286a2cc72c5d07870cc9a6ce0bf4 (diff)
downloadbrew-928eaca26720fd38b07c1e7df3f9f567477d48db.tar.bz2
Merge branch 'master' into exclude-executable-metafiles
Added tests in keg_test and pathname_test was moved into keg_spec and pathname_spec.
Diffstat (limited to 'Library/Homebrew/test/utils')
-rw-r--r--Library/Homebrew/test/utils/bottles/bottles_spec.rb80
1 files changed, 80 insertions, 0 deletions
diff --git a/Library/Homebrew/test/utils/bottles/bottles_spec.rb b/Library/Homebrew/test/utils/bottles/bottles_spec.rb
new file mode 100644
index 000000000..8b54b0b34
--- /dev/null
+++ b/Library/Homebrew/test/utils/bottles/bottles_spec.rb
@@ -0,0 +1,80 @@
+require "utils/bottles"
+
+describe Utils::Bottles do
+ describe "#tag", :needs_macos do
+ it "returns :tiger_foo on Tiger PowerPC" do
+ allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.4"))
+ allow(Hardware::CPU).to receive(:type).and_return(:ppc)
+ allow(Hardware::CPU).to receive(:family).and_return(:foo)
+ allow(MacOS).to receive(:prefer_64_bit?).and_return(false)
+ expect(described_class.tag).to eq(:tiger_foo)
+ end
+
+ it "returns :tiger on Tiger Intel" do
+ allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.4"))
+ allow(Hardware::CPU).to receive(:type).and_return(:intel)
+ allow(MacOS).to receive(:prefer_64_bit?).and_return(false)
+ expect(described_class.tag).to eq(:tiger)
+ end
+
+ it "returns :tiger_g5_64 on Tiger PowerPC 64-bit" do
+ allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.4"))
+ allow(Hardware::CPU).to receive(:type).and_return(:ppc)
+ allow(Hardware::CPU).to receive(:family).and_return(:g5)
+ allow(MacOS).to receive(:prefer_64_bit?).and_return(true)
+ expect(described_class.tag).to eq(:tiger_g5_64)
+ end
+
+ # Note that this will probably never be used
+ it "returns :tiger_64 on Tiger Intel 64-bit" do
+ allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.4"))
+ allow(Hardware::CPU).to receive(:type).and_return(:intel)
+ allow(MacOS).to receive(:prefer_64_bit?).and_return(true)
+ expect(described_class.tag).to eq(:tiger_64)
+ end
+
+ it "returns :leopard on Leopard Intel" do
+ allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.5"))
+ allow(Hardware::CPU).to receive(:type).and_return(:intel)
+ allow(MacOS).to receive(:prefer_64_bit?).and_return(false)
+ expect(described_class.tag).to eq(:leopard)
+ end
+
+ it "returns :leopard_g5_64 on Leopard PowerPC 64-bit" do
+ allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.5"))
+ allow(Hardware::CPU).to receive(:type).and_return(:ppc)
+ allow(Hardware::CPU).to receive(:family).and_return(:g5)
+ allow(MacOS).to receive(:prefer_64_bit?).and_return(true)
+ expect(described_class.tag).to eq(:leopard_g5_64)
+ end
+
+ it "returns :leopard_64 on Leopard Intel 64-bit" do
+ allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.5"))
+ allow(Hardware::CPU).to receive(:type).and_return(:intel)
+ allow(MacOS).to receive(:prefer_64_bit?).and_return(true)
+ expect(described_class.tag).to eq(:leopard_64)
+ end
+
+ it "returns :snow_leopard_32 on Snow Leopard 32-bit" do
+ allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.6"))
+ allow(Hardware::CPU).to receive(:is_64_bit?).and_return(false)
+ expect(described_class.tag).to eq(:snow_leopard_32)
+ end
+
+ it "returns :snow_leopard on Snow Leopard 64-bit" do
+ allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.6"))
+ allow(Hardware::CPU).to receive(:is_64_bit?).and_return(true)
+ expect(described_class.tag).to eq(:snow_leopard)
+ end
+
+ it "returns :lion on Lion" do
+ allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.7"))
+ expect(described_class.tag).to eq(:lion)
+ end
+
+ it "returns :mountain_lion on Mountain Lion" do
+ allow(MacOS).to receive(:version).and_return(MacOS::Version.new("10.8"))
+ expect(described_class.tag).to eq(:mountain_lion)
+ end
+ end
+end