mirror support: Add test
This commit is contained in:
parent
9d19506ee9
commit
3ada407922
@ -6,6 +6,9 @@ ARGV.extend(HomebrewArgvExtension)
|
|||||||
require 'test/testball'
|
require 'test/testball'
|
||||||
require 'utils'
|
require 'utils'
|
||||||
|
|
||||||
|
class AbstractDownloadStrategy
|
||||||
|
attr_reader :url
|
||||||
|
end
|
||||||
|
|
||||||
class MostlyAbstractFormula <Formula
|
class MostlyAbstractFormula <Formula
|
||||||
@url=''
|
@url=''
|
||||||
@ -51,4 +54,12 @@ class FormulaTests < Test::Unit::TestCase
|
|||||||
nostdout { assert_raises(RuntimeError) { f.brew } }
|
nostdout { assert_raises(RuntimeError) { f.brew } }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_mirror_support
|
||||||
|
HOMEBREW_CACHE.mkpath unless HOMEBREW_CACHE.exist?
|
||||||
|
f = TestBallWithMirror.new
|
||||||
|
tarball, downloader = f.fetch
|
||||||
|
|
||||||
|
assert_equal f.url, "file:///#{TEST_FOLDER}/bad_url/testball-0.1.tbz"
|
||||||
|
assert_equal downloader.url, "file:///#{TEST_FOLDER}/tarballs/testball-0.1.tbz"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -13,6 +13,18 @@ class TestBall <Formula
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class TestBallWithMirror < Formula
|
||||||
|
# `url` is bogus---curl should fail to download it. The mirror is fine
|
||||||
|
# though.
|
||||||
|
url "file:///#{TEST_FOLDER}/bad_url/testball-0.1.tbz"
|
||||||
|
mirror "file:///#{TEST_FOLDER}/tarballs/testball-0.1.tbz"
|
||||||
|
|
||||||
|
def initialize name=nil
|
||||||
|
@homepage = 'http://example.com/'
|
||||||
|
super "testballwithmirror"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class ConfigureFails <Formula
|
class ConfigureFails <Formula
|
||||||
# name parameter required for some Formula::factory
|
# name parameter required for some Formula::factory
|
||||||
def initialize name=nil
|
def initialize name=nil
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user