From 210957a0a859fc7b81f5a55ecb9cfe85a0141f7d Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Sun, 19 Oct 2014 01:14:32 -0500 Subject: [PATCH] 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. --- Formula/dnsrend.rb | 3 +-- Formula/gd.rb | 3 +-- Formula/graphicsmagick.rb | 3 +-- Formula/hachoir-metadata.rb | 3 +-- Formula/imagemagick.rb | 3 +-- Formula/imlib2.rb | 3 +-- Formula/jpeg-turbo.rb | 3 +-- Formula/mozjpeg.rb | 3 +-- Formula/ndpi.rb | 3 +-- Formula/p0f.rb | 3 +-- Formula/swftools.rb | 3 +-- Formula/tiff2png.rb | 3 +-- Formula/webp.rb | 3 +-- 13 files changed, 13 insertions(+), 26 deletions(-) diff --git a/Formula/dnsrend.rb b/Formula/dnsrend.rb index 3a18f0f9dc..ce57a114a5 100644 --- a/Formula/dnsrend.rb +++ b/Formula/dnsrend.rb @@ -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 diff --git a/Formula/gd.rb b/Formula/gd.rb index 56dddfb4bc..35918e4101 100644 --- a/Formula/gd.rb +++ b/Formula/gd.rb @@ -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 diff --git a/Formula/graphicsmagick.rb b/Formula/graphicsmagick.rb index 2e3989f545..a5ed545ad0 100644 --- a/Formula/graphicsmagick.rb +++ b/Formula/graphicsmagick.rb @@ -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 diff --git a/Formula/hachoir-metadata.rb b/Formula/hachoir-metadata.rb index b7eb579157..84c423e43f 100644 --- a/Formula/hachoir-metadata.rb +++ b/Formula/hachoir-metadata.rb @@ -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 diff --git a/Formula/imagemagick.rb b/Formula/imagemagick.rb index 3acd6a7a48..527bb8bf28 100644 --- a/Formula/imagemagick.rb +++ b/Formula/imagemagick.rb @@ -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 diff --git a/Formula/imlib2.rb b/Formula/imlib2.rb index ce4156a60b..4fbbc7803f 100644 --- a/Formula/imlib2.rb +++ b/Formula/imlib2.rb @@ -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 diff --git a/Formula/jpeg-turbo.rb b/Formula/jpeg-turbo.rb index b62176a41c..edb7511d9e 100644 --- a/Formula/jpeg-turbo.rb +++ b/Formula/jpeg-turbo.rb @@ -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 diff --git a/Formula/mozjpeg.rb b/Formula/mozjpeg.rb index 6d85cfbbef..e7821e3526 100644 --- a/Formula/mozjpeg.rb +++ b/Formula/mozjpeg.rb @@ -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 diff --git a/Formula/ndpi.rb b/Formula/ndpi.rb index 79af7f7838..3c5ba3d13f 100644 --- a/Formula/ndpi.rb +++ b/Formula/ndpi.rb @@ -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 diff --git a/Formula/p0f.rb b/Formula/p0f.rb index 9346815d0e..dc0530feb1 100644 --- a/Formula/p0f.rb +++ b/Formula/p0f.rb @@ -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 diff --git a/Formula/swftools.rb b/Formula/swftools.rb index fd18543421..a88cb95806 100644 --- a/Formula/swftools.rb +++ b/Formula/swftools.rb @@ -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 diff --git a/Formula/tiff2png.rb b/Formula/tiff2png.rb index 46ea0a885a..56bd069de3 100644 --- a/Formula/tiff2png.rb +++ b/Formula/tiff2png.rb @@ -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 diff --git a/Formula/webp.rb b/Formula/webp.rb index be67650cfd..c41c5333b5 100644 --- a/Formula/webp.rb +++ b/Formula/webp.rb @@ -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