aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test/test_tab.rb
diff options
context:
space:
mode:
authorMike McQuaid2016-09-09 07:47:05 +0100
committerGitHub2016-09-09 07:47:05 +0100
commit1d66cdd3ade841c6b7cd8a71d4b71d5426d00a58 (patch)
treea3b70c2abb1db95210e65bab5569f1718b8bcc7f /Library/Homebrew/test/test_tab.rb
parentf37d004ab5588d7b24a593ad8619f024b8c91a6b (diff)
parent4f1d47bc156253ab0eabf6b7aba1fcfa46d80633 (diff)
downloadbrew-1d66cdd3ade841c6b7cd8a71d4b71d5426d00a58.tar.bz2
Merge pull request #863 from penman/preserve_alias
Save aliases in INSTALL_RECEIPT
Diffstat (limited to 'Library/Homebrew/test/test_tab.rb')
-rw-r--r--Library/Homebrew/test/test_tab.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_tab.rb b/Library/Homebrew/test/test_tab.rb
index 8a261a46a..962bfc602 100644
--- a/Library/Homebrew/test/test_tab.rb
+++ b/Library/Homebrew/test/test_tab.rb
@@ -45,6 +45,7 @@ class TabTests < Homebrew::TestCase
assert_nil tab.head_version
assert_equal DevelopmentTools.default_compiler, tab.cxxstdlib.compiler
assert_nil tab.cxxstdlib.type
+ assert_nil tab.source["path"]
end
def test_include?
@@ -99,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)
+ 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
@@ -116,6 +118,41 @@ 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 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
@@ -133,6 +170,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.source["path"], tab.source["path"]
end
def test_remap_deprecated_options