aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorBaptiste Fontaine2016-01-25 11:48:13 +0100
committerBaptiste Fontaine2016-01-25 17:19:51 +0100
commitbb588df05800b4a58f111bf028c6f7c73b70524c (patch)
tree36b9ace994b4aadb742f8387bf539f8b517b6302 /Library/Homebrew
parente1875b7a43f233252d795a4e10ee4125658466e8 (diff)
downloadbrew-bb588df05800b4a58f111bf028c6f7c73b70524c.tar.bz2
tests: add pkgshare audit tests
Closes Homebrew/homebrew#48435. Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
Diffstat (limited to 'Library/Homebrew')
-rw-r--r--Library/Homebrew/test/test_cmd_audit.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/Library/Homebrew/test/test_cmd_audit.rb b/Library/Homebrew/test/test_cmd_audit.rb
index 16c0426ed..118dba544 100644
--- a/Library/Homebrew/test/test_cmd_audit.rb
+++ b/Library/Homebrew/test/test_cmd_audit.rb
@@ -256,4 +256,30 @@ class FormulaAuditorTests < Homebrew::TestCase
assert_equal ["AmazonWebServicesFormula is deprecated, use Formula instead"],
fa.problems
end
+
+ def test_audit_line_pkgshare
+ fa = formula_auditor "foo", <<-EOS.undent, :strict => true
+ class Foo < Formula
+ url "http://example.com/foo-1.0.tgz"
+ end
+ EOS
+ fa.audit_line 'ohai "#{share}/foo"', 3
+ assert_equal "Use \#{pkgshare} instead of \#{share}/foo", fa.problems.shift
+
+ fa.audit_line 'ohai "#{share}/foo/bar"', 3
+ assert_equal "Use \#{pkgshare} instead of \#{share}/foo", fa.problems.shift
+
+ fa.audit_line 'ohai share/"foo"', 3
+ assert_equal 'Use pkgshare instead of (share/"foo")', fa.problems.shift
+
+ fa.audit_line 'ohai share/"foo/bar"', 3
+ assert_equal 'Use pkgshare instead of (share/"foo")', fa.problems.shift
+
+ fa.audit_line 'ohai "#{share}/foo-bar"', 3
+ assert_equal [], fa.problems
+ fa.audit_line 'ohai share/"foo-bar"', 3
+ assert_equal [], fa.problems
+ fa.audit_line 'ohai share/"bar"', 3
+ assert_equal [], fa.problems
+ end
end