diff options
| author | Jack Nagel | 2014-10-19 01:14:32 -0500 | 
|---|---|---|
| committer | Jack Nagel | 2014-10-19 01:18:26 -0500 | 
| commit | 878e2308d996481324315f3d6fb523ec38f85082 (patch) | |
| tree | 3672190756120b5d46661e06683dbeb390774553 | |
| parent | 623194855e4083d7dd0120147d85eea8a08d938f (diff) | |
| download | homebrew-878e2308d996481324315f3d6fb523ec38f85082.tar.bz2 | |
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.
| -rw-r--r-- | Library/Formula/dnsrend.rb | 3 | ||||
| -rw-r--r-- | Library/Formula/gd.rb | 3 | ||||
| -rw-r--r-- | Library/Formula/graphicsmagick.rb | 3 | ||||
| -rw-r--r-- | Library/Formula/hachoir-metadata.rb | 3 | ||||
| -rw-r--r-- | Library/Formula/imagemagick.rb | 3 | ||||
| -rw-r--r-- | Library/Formula/imlib2.rb | 3 | ||||
| -rw-r--r-- | Library/Formula/jpeg-turbo.rb | 3 | ||||
| -rw-r--r-- | Library/Formula/mozjpeg.rb | 3 | ||||
| -rw-r--r-- | Library/Formula/ndpi.rb | 3 | ||||
| -rw-r--r-- | Library/Formula/p0f.rb | 3 | ||||
| -rw-r--r-- | Library/Formula/swftools.rb | 3 | ||||
| -rw-r--r-- | Library/Formula/tiff2png.rb | 3 | ||||
| -rw-r--r-- | Library/Formula/webp.rb | 3 | ||||
| -rw-r--r-- | Library/Homebrew/formula.rb | 4 | 
14 files changed, 17 insertions, 26 deletions
| diff --git a/Library/Formula/dnsrend.rb b/Library/Formula/dnsrend.rb index 3a18f0f9d..ce57a114a 100644 --- a/Library/Formula/dnsrend.rb +++ b/Library/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/Library/Formula/gd.rb b/Library/Formula/gd.rb index 56dddfb4b..35918e410 100644 --- a/Library/Formula/gd.rb +++ b/Library/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/Library/Formula/graphicsmagick.rb b/Library/Formula/graphicsmagick.rb index 2e3989f54..a5ed545ad 100644 --- a/Library/Formula/graphicsmagick.rb +++ b/Library/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/Library/Formula/hachoir-metadata.rb b/Library/Formula/hachoir-metadata.rb index b7eb57915..84c423e43 100644 --- a/Library/Formula/hachoir-metadata.rb +++ b/Library/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/Library/Formula/imagemagick.rb b/Library/Formula/imagemagick.rb index 3acd6a7a4..527bb8bf2 100644 --- a/Library/Formula/imagemagick.rb +++ b/Library/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/Library/Formula/imlib2.rb b/Library/Formula/imlib2.rb index ce4156a60..4fbbc7803 100644 --- a/Library/Formula/imlib2.rb +++ b/Library/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/Library/Formula/jpeg-turbo.rb b/Library/Formula/jpeg-turbo.rb index b62176a41..edb7511d9 100644 --- a/Library/Formula/jpeg-turbo.rb +++ b/Library/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/Library/Formula/mozjpeg.rb b/Library/Formula/mozjpeg.rb index 6d85cfbbe..e7821e352 100644 --- a/Library/Formula/mozjpeg.rb +++ b/Library/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/Library/Formula/ndpi.rb b/Library/Formula/ndpi.rb index 79af7f783..3c5ba3d13 100644 --- a/Library/Formula/ndpi.rb +++ b/Library/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/Library/Formula/p0f.rb b/Library/Formula/p0f.rb index 9346815d0..dc0530feb 100644 --- a/Library/Formula/p0f.rb +++ b/Library/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/Library/Formula/swftools.rb b/Library/Formula/swftools.rb index fd1854342..a88cb9580 100644 --- a/Library/Formula/swftools.rb +++ b/Library/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/Library/Formula/tiff2png.rb b/Library/Formula/tiff2png.rb index 46ea0a885..56bd069de 100644 --- a/Library/Formula/tiff2png.rb +++ b/Library/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/Library/Formula/webp.rb b/Library/Formula/webp.rb index be67650cf..c41c5333b 100644 --- a/Library/Formula/webp.rb +++ b/Library/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 diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb index c0fb1d3e6..956056244 100644 --- a/Library/Homebrew/formula.rb +++ b/Library/Homebrew/formula.rb @@ -498,6 +498,10 @@ class Formula    def test    end +  def test_fixtures(file) +    HOMEBREW_LIBRARY.join("Homebrew", "test", "fixtures", file) +  end +    protected    # :startdoc: | 
