Provide a method to access test fixtures

Formulae should not require knowledge of Homebrew's internal directory
structure, and we should be able to alter it without modifying
individual formulae.
This commit is contained in:
Jack Nagel 2014-10-19 01:14:32 -05:00
parent 7a4b35108e
commit 210957a0a8
13 changed files with 13 additions and 26 deletions

View file

@ -42,7 +42,6 @@ class Dnsrend < Formula
end
test do
test_pcap = HOMEBREW_LIBRARY/"Homebrew/test/fixtures/test.pcap"
system "#{bin}/dnsrend", test_pcap
system "#{bin}/dnsrend", test_fixtures("test.pcap")
end
end

View file

@ -74,8 +74,7 @@ class Gd < Formula
end
test do
test_png = HOMEBREW_LIBRARY/"Homebrew/test/fixtures/test.png"
system "#{bin}/pngtogd", test_png, "gd_test.gd"
system "#{bin}/pngtogd", test_fixtures("test.png"), "gd_test.gd"
system "#{bin}/gdtopng", "gd_test.gd", "gd_test.png"
end
end

View file

@ -88,8 +88,7 @@ class Graphicsmagick < Formula
end
test do
test_png = HOMEBREW_LIBRARY/"Homebrew/test/fixtures/test.png"
system "#{bin}/gm", "identify", test_png
system "#{bin}/gm", "identify", test_fixtures("test.png")
end
def caveats

View file

@ -45,8 +45,7 @@ class HachoirMetadata < Formula
end
test do
test_png = HOMEBREW_LIBRARY/"Homebrew/test/fixtures/test.png"
output = `#{bin}/hachoir-metadata --mime #{test_png}`
output = `#{bin}/hachoir-metadata --mime #{test_fixtures("test.png")}`
assert output.include?("image/png")
assert_equal 0, $?.exitstatus
end

View file

@ -116,7 +116,6 @@ class Imagemagick < Formula
end
test do
test_png = HOMEBREW_LIBRARY/"Homebrew/test/fixtures/test.png"
system "#{bin}/identify", test_png
system "#{bin}/identify", test_fixtures("test.png")
end
end

View file

@ -33,7 +33,6 @@ class Imlib2 < Formula
end
test do
test_png = HOMEBREW_LIBRARY/"Homebrew/test/fixtures/test.png"
system "#{bin}/imlib2_conv", test_png, "imlib2_test.png"
system "#{bin}/imlib2_conv", test_fixtures("test.png"), "imlib2_test.png"
end
end

View file

@ -26,10 +26,9 @@ class JpegTurbo < Formula
end
test do
test_jpg = HOMEBREW_LIBRARY/"Homebrew/test/fixtures/test.jpg"
system "#{bin}/jpegtran", "-crop", "1x1",
"-transpose", "-perfect",
"-outfile", "out.jpg",
test_jpg
test_fixtures("test.jpg")
end
end

View file

@ -30,10 +30,9 @@ class Mozjpeg < Formula
end
test do
test_jpg = HOMEBREW_LIBRARY/"Homebrew/test/fixtures/test.jpg"
system "#{bin}/jpegtran", "-crop", "1x1",
"-transpose", "-optimize",
"-outfile", "out.jpg",
test_jpg
test_fixtures("test.jpg")
end
end

View file

@ -25,7 +25,6 @@ class Ndpi < Formula
end
test do
test_pcap = HOMEBREW_LIBRARY/"Homebrew/test/fixtures/test.pcap"
system "#{bin}/ndpiReader", "-i", test_pcap
system "#{bin}/ndpiReader", "-i", test_fixtures("test.pcap")
end
end

View file

@ -20,7 +20,6 @@ class P0f < Formula
end
test do
test_pcap = HOMEBREW_LIBRARY/"Homebrew/test/fixtures/test.pcap"
system "#{sbin}/p0f", "-r", test_pcap
system "#{sbin}/p0f", "-r", test_fixtures("test.pcap")
end
end

View file

@ -32,8 +32,7 @@ class Swftools < Formula
end
test do
test_png = HOMEBREW_LIBRARY/"Homebrew/test/fixtures/test.png"
system "#{bin}/png2swf", "swftools_test.swf", test_png
system "#{bin}/png2swf", "swftools_test.swf", test_fixtures("test.png")
end
end

View file

@ -25,8 +25,7 @@ class Tiff2png < Formula
end
test do
test_tiff = HOMEBREW_LIBRARY/"Homebrew/test/fixtures/test.tiff"
system "#{bin}/tiff2png", test_tiff
system "#{bin}/tiff2png", test_fixtures("test.tiff")
end
end

View file

@ -33,8 +33,7 @@ class Webp < Formula
end
test do
test_png = HOMEBREW_LIBRARY/"Homebrew/test/fixtures/test.png"
system "#{bin}/cwebp", test_png, "-o", "webp_test.png"
system "#{bin}/cwebp", test_fixtures("test.png"), "-o", "webp_test.png"
system "#{bin}/dwebp", "webp_test.png", "-o", "webp_test.webp"
end
end