From 541e8f28df7f8d7a21f976e669190a32fe88473e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sat, 16 Jul 2016 21:06:30 +0100 Subject: [PATCH] bottles: more porting to generic layer. --- ...l_bottle-0.1.macintosh_intel.bottle.tar.gz | 1 + .../Homebrew/test/test_bottle_collector.rb | 14 ---------- .../test/test_os_mac_bottle_collector.rb | 26 +++++++++++++++++++ ...ottle_tag.rb => test_os_mac_bottle_tag.rb} | 2 +- Library/Homebrew/utils/bottles.rb | 2 +- 5 files changed, 29 insertions(+), 16 deletions(-) create mode 120000 Library/Homebrew/test/bottles/testball_bottle-0.1.macintosh_intel.bottle.tar.gz create mode 100644 Library/Homebrew/test/test_os_mac_bottle_collector.rb rename Library/Homebrew/test/{test_bottle_tag.rb => test_os_mac_bottle_tag.rb} (98%) diff --git a/Library/Homebrew/test/bottles/testball_bottle-0.1.macintosh_intel.bottle.tar.gz b/Library/Homebrew/test/bottles/testball_bottle-0.1.macintosh_intel.bottle.tar.gz new file mode 120000 index 0000000000..3e989830ba --- /dev/null +++ b/Library/Homebrew/test/bottles/testball_bottle-0.1.macintosh_intel.bottle.tar.gz @@ -0,0 +1 @@ +testball_bottle-0.1.yosemite.bottle.tar.gz \ No newline at end of file diff --git a/Library/Homebrew/test/test_bottle_collector.rb b/Library/Homebrew/test/test_bottle_collector.rb index fa356cb93e..d75e29ec86 100644 --- a/Library/Homebrew/test/test_bottle_collector.rb +++ b/Library/Homebrew/test/test_bottle_collector.rb @@ -30,23 +30,9 @@ class BottleCollectorTests < Homebrew::TestCase assert_nil checksum_for(:foo) end - def test_collector_finds_or_later_tags - @collector[:lion_or_later] = "foo" - assert_equal ["foo", :lion_or_later], checksum_for(:mountain_lion) - assert_nil checksum_for(:snow_leopard) - end - def test_collector_prefers_exact_matches @collector[:lion_or_later] = "foo" @collector[:mountain_lion] = "bar" assert_equal ["bar", :mountain_lion], checksum_for(:mountain_lion) end - - def test_collector_finds_altivec_tags - @collector[:tiger_altivec] = "foo" - assert_equal ["foo", :tiger_altivec], checksum_for(:tiger_g4) - assert_equal ["foo", :tiger_altivec], checksum_for(:tiger_g4e) - assert_equal ["foo", :tiger_altivec], checksum_for(:tiger_g5) - assert_nil checksum_for(:tiger_g3) - end end diff --git a/Library/Homebrew/test/test_os_mac_bottle_collector.rb b/Library/Homebrew/test/test_os_mac_bottle_collector.rb new file mode 100644 index 0000000000..2f88050aed --- /dev/null +++ b/Library/Homebrew/test/test_os_mac_bottle_collector.rb @@ -0,0 +1,26 @@ +require "testing_env" +require "utils/bottles" + +class OSMacBottleCollectorTests < Homebrew::TestCase + def setup + @collector = Utils::Bottles::Collector.new + end + + def checksum_for(tag) + @collector.fetch_checksum_for(tag) + end + + def test_collector_finds_or_later_tags + @collector[:lion_or_later] = "foo" + assert_equal ["foo", :lion_or_later], checksum_for(:mountain_lion) + assert_nil checksum_for(:snow_leopard) + end + + def test_collector_finds_altivec_tags + @collector[:tiger_altivec] = "foo" + assert_equal ["foo", :tiger_altivec], checksum_for(:tiger_g4) + assert_equal ["foo", :tiger_altivec], checksum_for(:tiger_g4e) + assert_equal ["foo", :tiger_altivec], checksum_for(:tiger_g5) + assert_nil checksum_for(:tiger_g3) + end +end diff --git a/Library/Homebrew/test/test_bottle_tag.rb b/Library/Homebrew/test/test_os_mac_bottle_tag.rb similarity index 98% rename from Library/Homebrew/test/test_bottle_tag.rb rename to Library/Homebrew/test/test_os_mac_bottle_tag.rb index 174c7d14ec..996bd4d536 100644 --- a/Library/Homebrew/test/test_bottle_tag.rb +++ b/Library/Homebrew/test/test_os_mac_bottle_tag.rb @@ -1,7 +1,7 @@ require "testing_env" require "utils/bottles" -class BottleTagTests < Homebrew::TestCase +class OSMacBottleTagTests < Homebrew::TestCase def test_tag_tiger_ppc MacOS.stubs(:version).returns(MacOS::Version.new("10.4")) Hardware::CPU.stubs(:type).returns(:ppc) diff --git a/Library/Homebrew/utils/bottles.rb b/Library/Homebrew/utils/bottles.rb index 8447f24726..7b40a2e41e 100644 --- a/Library/Homebrew/utils/bottles.rb +++ b/Library/Homebrew/utils/bottles.rb @@ -5,7 +5,7 @@ module Utils class Bottles class << self def tag - @bottle_tag ||= "#{ENV["HOMEBREW_SYSTEM"]}-#{ENV["HOMEBREW_PROCESSOR"]}".downcase.to_sym + @bottle_tag ||= "#{ENV["HOMEBREW_SYSTEM"]}_#{ENV["HOMEBREW_PROCESSOR"]}".downcase.to_sym end def built_as?(f)