brew/Library/Homebrew/test/test_bottle_collector.rb

39 lines
968 B
Ruby
Raw Normal View History

require "testing_env"
2016-04-25 17:57:51 +01:00
require "utils/bottles"
class BottleCollectorTests < Homebrew::TestCase
def setup
2016-04-25 17:57:51 +01:00
@collector = Utils::Bottles::Collector.new
end
def checksum_for(tag)
@collector.fetch_checksum_for(tag)
end
def test_collector_returns_passed_tags
2014-07-15 21:55:14 -05:00
@collector[:lion] = "foo"
@collector[:mountain_lion] = "bar"
assert_equal ["bar", :mountain_lion], checksum_for(:mountain_lion)
end
2014-07-16 21:11:48 -05:00
def test_collector_returns_when_empty
assert_nil checksum_for(:foo)
end
def test_collector_returns_nil_for_no_match
@collector[:lion] = "foo"
assert_nil checksum_for(:foo)
end
def test_collector_returns_nil_for_no_match_when_later_tag_present
@collector[:lion_or_later] = "foo"
assert_nil checksum_for(:foo)
end
def test_collector_prefers_exact_matches
2014-07-15 21:55:14 -05:00
@collector[:lion_or_later] = "foo"
@collector[:mountain_lion] = "bar"
assert_equal ["bar", :mountain_lion], checksum_for(:mountain_lion)
end
end