Skip to content
Snippets Groups Projects
Commit bb588df0 authored by Baptiste Fontaine's avatar Baptiste Fontaine
Browse files

tests: add pkgshare audit tests


Closes Homebrew/homebrew#48435.

Signed-off-by: default avatarBaptiste Fontaine <batifon@yahoo.fr>
parent e1875b7a
No related branches found
No related tags found
No related merge requests found
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment