diff options
| author | Alyssa Ross | 2016-09-03 21:10:44 +0100 |
|---|---|---|
| committer | Alyssa Ross | 2016-09-03 21:16:43 +0100 |
| commit | 0ef3e1e0dcbcd5aa55408fe81d23613e1c2c5e79 (patch) | |
| tree | 15c68c1d02e144cb86c32bc870cf75cc6547d8e0 /Library/Homebrew/test | |
| parent | 9fd97dd3cf26b6644a9f808945869b2af44db26e (diff) | |
| download | brew-0ef3e1e0dcbcd5aa55408fe81d23613e1c2c5e79.tar.bz2 | |
Preserve alias when installing formulae
Part of #567
Diffstat (limited to 'Library/Homebrew/test')
| -rw-r--r-- | Library/Homebrew/test/fixtures/receipt.json | 1 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_formula.rb | 19 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_formulary.rb | 4 | ||||
| -rw-r--r-- | Library/Homebrew/test/test_tab.rb | 3 | ||||
| -rw-r--r-- | Library/Homebrew/test/testball.rb | 2 | ||||
| -rw-r--r-- | Library/Homebrew/test/testball_bottle.rb | 2 |
6 files changed, 27 insertions, 4 deletions
diff --git a/Library/Homebrew/test/fixtures/receipt.json b/Library/Homebrew/test/fixtures/receipt.json index 4a829788e..cf93f932d 100644 --- a/Library/Homebrew/test/fixtures/receipt.json +++ b/Library/Homebrew/test/fixtures/receipt.json @@ -11,6 +11,7 @@ "poured_from_bottle": true, "time": 1403827774, "HEAD": "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef", + "install_name": "test-formula", "stdlib": "libcxx", "compiler": "clang", "source": { diff --git a/Library/Homebrew/test/test_formula.rb b/Library/Homebrew/test/test_formula.rb index 7ebb17884..1ea1ff185 100644 --- a/Library/Homebrew/test/test_formula.rb +++ b/Library/Homebrew/test/test_formula.rb @@ -8,13 +8,30 @@ class FormulaTests < Homebrew::TestCase name = "formula_name" path = Formulary.core_path(name) spec = :stable + install_name = "formula_alias" - f = klass.new(name, path, spec) + f = klass.new(name, path, spec, install_name: install_name) assert_equal name, f.name assert_equal path, f.path + assert_equal install_name, f.install_name assert_raises(ArgumentError) { klass.new } end + def test_install_ref_with_alias + name = "formula_name" + path = Formulary.core_path(name) + spec = :stable + install_name = "formula_alias" + + f = Testball.new(name, path, spec, install_name: install_name) + assert_equal f.install_name, f.install_ref + end + + def test_install_ref_with_non_alias + f = Testball.new + assert_equal f.path, f.install_ref + end + def test_prefix f = Testball.new assert_equal HOMEBREW_CELLAR/f.name/"0.1", f.prefix diff --git a/Library/Homebrew/test/test_formulary.rb b/Library/Homebrew/test/test_formulary.rb index abc034e14..0d34132ec 100644 --- a/Library/Homebrew/test/test_formulary.rb +++ b/Library/Homebrew/test/test_formulary.rb @@ -86,7 +86,9 @@ class FormularyFactoryTest < Homebrew::TestCase alias_dir = CoreTap.instance.alias_dir alias_dir.mkpath FileUtils.ln_s @path, alias_dir/"foo" - assert_kind_of Formula, Formulary.factory("foo") + result = Formulary.factory("foo") + assert_kind_of Formula, result + assert_equal "foo", result.install_name ensure alias_dir.rmtree end diff --git a/Library/Homebrew/test/test_tab.rb b/Library/Homebrew/test/test_tab.rb index 8a261a46a..dd61fd57b 100644 --- a/Library/Homebrew/test/test_tab.rb +++ b/Library/Homebrew/test/test_tab.rb @@ -43,6 +43,7 @@ class TabTests < Homebrew::TestCase assert_nil tab.stable_version assert_nil tab.devel_version assert_nil tab.head_version + assert_nil tab.install_name assert_equal DevelopmentTools.default_compiler, tab.cxxstdlib.compiler assert_nil tab.cxxstdlib.type end @@ -116,6 +117,7 @@ class TabTests < Homebrew::TestCase assert_equal "2.14", tab.stable_version.to_s assert_equal "2.15", tab.devel_version.to_s assert_equal "HEAD-0000000", tab.head_version.to_s + assert_equal "test-formula", tab.install_name end def test_to_json @@ -133,6 +135,7 @@ class TabTests < Homebrew::TestCase assert_equal @tab.stable_version, tab.stable_version assert_equal @tab.devel_version, tab.devel_version assert_equal @tab.head_version, tab.head_version + assert_equal @tab.install_name, tab.install_name end def test_remap_deprecated_options diff --git a/Library/Homebrew/test/testball.rb b/Library/Homebrew/test/testball.rb index c1b09111b..c13c73adb 100644 --- a/Library/Homebrew/test/testball.rb +++ b/Library/Homebrew/test/testball.rb @@ -1,5 +1,5 @@ class Testball < Formula - def initialize(name = "testball", path = Pathname.new(__FILE__).expand_path, spec = :stable) + def initialize(name = "testball", path = Pathname.new(__FILE__).expand_path, spec = :stable, install_name: name) self.class.instance_eval do stable.url "file://#{File.expand_path("..", __FILE__)}/tarballs/testball-0.1.tbz" stable.sha256 TESTBALL_SHA256 diff --git a/Library/Homebrew/test/testball_bottle.rb b/Library/Homebrew/test/testball_bottle.rb index 5aa582fa8..584478afd 100644 --- a/Library/Homebrew/test/testball_bottle.rb +++ b/Library/Homebrew/test/testball_bottle.rb @@ -1,5 +1,5 @@ class TestballBottle < Formula - def initialize(name = "testball_bottle", path = Pathname.new(__FILE__).expand_path, spec = :stable) + def initialize(name = "testball_bottle", path = Pathname.new(__FILE__).expand_path, spec = :stable, install_name: name) self.class.instance_eval do stable.url "file://#{File.expand_path("..", __FILE__)}/tarballs/testball-0.1.tbz" stable.sha256 TESTBALL_SHA256 |
