From 0ef3e1e0dcbcd5aa55408fe81d23613e1c2c5e79 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sat, 3 Sep 2016 21:10:44 +0100 Subject: Preserve alias when installing formulae Part of #567 --- Library/Homebrew/test/test_tab.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Library/Homebrew/test/test_tab.rb') 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 -- cgit v1.2.3 From 65ee5408c3d000393c1b73bfe8fb731a651ee281 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Mon, 5 Sep 2016 01:11:36 +0100 Subject: Replace install_name/install_ref with alias_path --- Library/Homebrew/test/test_tab.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Library/Homebrew/test/test_tab.rb') diff --git a/Library/Homebrew/test/test_tab.rb b/Library/Homebrew/test/test_tab.rb index dd61fd57b..85fcf4d16 100644 --- a/Library/Homebrew/test/test_tab.rb +++ b/Library/Homebrew/test/test_tab.rb @@ -43,7 +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_nil tab.alias_path assert_equal DevelopmentTools.default_compiler, tab.cxxstdlib.compiler assert_nil tab.cxxstdlib.type end @@ -117,7 +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 + assert_equal "test-formula", tab.alias_path end def test_to_json @@ -135,7 +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 + assert_equal @tab.alias_path, tab.alias_path end def test_remap_deprecated_options -- cgit v1.2.3 From b90eba8ffd9549879bf4c911377d8d4cf9aa7b39 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Mon, 5 Sep 2016 14:21:00 +0100 Subject: Update Tap for alias_path --- Library/Homebrew/test/test_tab.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Library/Homebrew/test/test_tab.rb') diff --git a/Library/Homebrew/test/test_tab.rb b/Library/Homebrew/test/test_tab.rb index 85fcf4d16..be528390a 100644 --- a/Library/Homebrew/test/test_tab.rb +++ b/Library/Homebrew/test/test_tab.rb @@ -100,6 +100,7 @@ class TabTests < Homebrew::TestCase def test_from_file path = Pathname.new(TEST_DIRECTORY).join("fixtures", "receipt.json") tab = Tab.from_file(path) + alias_path = Pathname.new("/usr/local/Library/Taps/homebrew/homebrew-core/Aliases/test-formula") assert_equal @used.sort, tab.used_options.sort assert_equal @unused.sort, tab.unused_options.sort @@ -117,7 +118,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.alias_path + assert_equal alias_path, tab.alias_path end def test_to_json -- cgit v1.2.3 From f9e16ee2e04b7b23b273bfa683ab54a85ed40660 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Wed, 7 Sep 2016 22:48:52 +0100 Subject: Combine Tab alias_path with source.path --- Library/Homebrew/test/test_tab.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Library/Homebrew/test/test_tab.rb') diff --git a/Library/Homebrew/test/test_tab.rb b/Library/Homebrew/test/test_tab.rb index be528390a..a5d50d81d 100644 --- a/Library/Homebrew/test/test_tab.rb +++ b/Library/Homebrew/test/test_tab.rb @@ -43,9 +43,9 @@ class TabTests < Homebrew::TestCase assert_nil tab.stable_version assert_nil tab.devel_version assert_nil tab.head_version - assert_nil tab.alias_path assert_equal DevelopmentTools.default_compiler, tab.cxxstdlib.compiler assert_nil tab.cxxstdlib.type + assert_nil tab.source["path"] end def test_include? @@ -100,7 +100,7 @@ class TabTests < Homebrew::TestCase def test_from_file path = Pathname.new(TEST_DIRECTORY).join("fixtures", "receipt.json") tab = Tab.from_file(path) - alias_path = Pathname.new("/usr/local/Library/Taps/homebrew/homebrew-core/Aliases/test-formula") + source_path = "/usr/local/Library/Taps/hombrew/homebrew-core/Formula/foo.rb" assert_equal @used.sort, tab.used_options.sort assert_equal @unused.sort, tab.unused_options.sort @@ -118,7 +118,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 alias_path, tab.alias_path + assert_equal source_path, tab.source["path"] end def test_to_json @@ -136,7 +136,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.alias_path, tab.alias_path + assert_equal @tab.source["path"], tab.source["path"] end def test_remap_deprecated_options -- cgit v1.2.3 From 4f1d47bc156253ab0eabf6b7aba1fcfa46d80633 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Wed, 7 Sep 2016 22:52:25 +0100 Subject: Test source.path on Tab.create and .for_formula --- Library/Homebrew/test/test_tab.rb | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'Library/Homebrew/test/test_tab.rb') diff --git a/Library/Homebrew/test/test_tab.rb b/Library/Homebrew/test/test_tab.rb index a5d50d81d..962bfc602 100644 --- a/Library/Homebrew/test/test_tab.rb +++ b/Library/Homebrew/test/test_tab.rb @@ -121,6 +121,40 @@ class TabTests < Homebrew::TestCase assert_equal source_path, tab.source["path"] end + def test_create + f = formula { url "foo-1.0" } + compiler = DevelopmentTools.default_compiler + stdlib = :libcxx + tab = Tab.create(f, compiler, stdlib) + + assert_equal f.path.to_s, tab.source["path"] + end + + def test_create_from_alias + alias_path = CoreTap.instance.alias_dir/"bar" + f = formula(:alias_path => alias_path) { url "foo-1.0" } + compiler = DevelopmentTools.default_compiler + stdlib = :libcxx + tab = Tab.create(f, compiler, stdlib) + + assert_equal f.alias_path.to_s, tab.source["path"] + end + + def test_for_formula + f = formula { url "foo-1.0" } + tab = Tab.for_formula(f) + + assert_equal f.path.to_s, tab.source["path"] + end + + def test_for_formula_from_alias + alias_path = CoreTap.instance.alias_dir/"bar" + f = formula(:alias_path => alias_path) { url "foo-1.0" } + tab = Tab.for_formula(f) + + assert_equal alias_path.to_s, tab.source["path"] + end + def test_to_json tab = Tab.new(Utils::JSON.load(@tab.to_json)) assert_equal @tab.used_options.sort, tab.used_options.sort -- cgit v1.2.3