aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/test/test_tab.rb34
-rw-r--r--Library/Homebrew/test/testing_env.rb4
2 files changed, 36 insertions, 2 deletions
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
diff --git a/Library/Homebrew/test/testing_env.rb b/Library/Homebrew/test/testing_env.rb
index 5d464b8cc..bc25f8ef8 100644
--- a/Library/Homebrew/test/testing_env.rb
+++ b/Library/Homebrew/test/testing_env.rb
@@ -72,8 +72,8 @@ module Homebrew
TEST_SHA1 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef".freeze
TEST_SHA256 = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef".freeze
- def formula(name = "formula_name", path = Formulary.core_path(name), spec = :stable, &block)
- @_f = Class.new(Formula, &block).new(name, path, spec)
+ def formula(name = "formula_name", path = Formulary.core_path(name), spec = :stable, alias_path: nil, &block)
+ @_f = Class.new(Formula, &block).new(name, path, spec, :alias_path => alias_path)
end
def mktmpdir(prefix_suffix = nil, &block)