aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorXu Cheng2016-02-15 22:31:47 +0800
committerXu Cheng2016-02-16 14:23:39 +0800
commit4e51c0b8ea371d15d2ae996700e1c988e79cab17 (patch)
treeee0cf40d3a6b095ac33c126e0095b601fe678ba9 /Library/Homebrew/test
parent578e68b2c1cda6af408ca04ed69877de15198b04 (diff)
downloadbrew-4e51c0b8ea371d15d2ae996700e1c988e79cab17.tar.bz2
add Tap#formula_file?
Return true if given path would present a Formula file in this Tap. Accepts both absolute path and relative path (relative to this Tap's path) It offer an abstraction such that caller would not need to worry about low level file system in the tap. It will be used in `brew pull` and `brew update`. Closes Homebrew/homebrew#49191. Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/test_tap.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_tap.rb b/Library/Homebrew/test/test_tap.rb
index 6e497a070..1159eb992 100644
--- a/Library/Homebrew/test/test_tap.rb
+++ b/Library/Homebrew/test/test_tap.rb
@@ -95,6 +95,10 @@ class TapTest < Homebrew::TestCase
assert_equal @tap.formula_renames, "oldname" => "foo"
assert_equal [@cmd_file], @tap.command_files
assert_kind_of Hash, @tap.to_hash
+ assert_equal true, @tap.formula_file?(@formula_file)
+ assert_equal true, @tap.formula_file?("Formula/foo.rb")
+ assert_equal false, @tap.formula_file?("bar.rb")
+ assert_equal false, @tap.formula_file?("Formula/baz.sh")
end
def test_remote