aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorJack Nagel2013-04-07 19:41:14 -0500
committerJack Nagel2013-04-07 20:59:51 -0500
commit0032f1669f6dd704c2257cc334071a7007446ac5 (patch)
tree68982185b18a57b5e11c5594680688489a52b7b4 /Library/Homebrew/test
parentc6474ff5b54678429452c5acd34a95a1b5d10a84 (diff)
downloadhomebrew-0032f1669f6dd704c2257cc334071a7007446ac5.tar.bz2
test_patching: inline test classes
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/test_patching.rb57
1 files changed, 23 insertions, 34 deletions
diff --git a/Library/Homebrew/test/test_patching.rb b/Library/Homebrew/test/test_patching.rb
index e0064864e..6642704c0 100644
--- a/Library/Homebrew/test/test_patching.rb
+++ b/Library/Homebrew/test/test_patching.rb
@@ -1,33 +1,6 @@
require 'testing_env'
require 'test/testball'
-
-class DefaultPatchBall < TestBall
- def patches
- # Default is p1
- "file:///#{TEST_FOLDER}/patches/noop-a.diff"
- end
-end
-
-class ListPatchBall < TestBall
- def patches
- ["file:///#{TEST_FOLDER}/patches/noop-a.diff"]
- end
-end
-
-class P0PatchBall < TestBall
- def patches
- { :p0 => ["file:///#{TEST_FOLDER}/patches/noop-b.diff"] }
- end
-end
-
-class P1PatchBall < TestBall
- def patches
- { :p1 => ["file:///#{TEST_FOLDER}/patches/noop-a.diff"] }
- end
-end
-
-
class PatchingTests < Test::Unit::TestCase
def read_file path
File.open(path, 'r') { |f| f.read }
@@ -35,7 +8,11 @@ class PatchingTests < Test::Unit::TestCase
def test_single_patch
shutup do
- DefaultPatchBall.new('test_patch').brew do
+ Class.new(TestBall) do
+ def patches
+ "file:///#{TEST_FOLDER}/patches/noop-a.diff"
+ end
+ end.new("test_single_patch").brew do
s = read_file 'libexec/NOOP'
assert !s.include?("NOOP"), "File was unpatched."
assert s.include?("ABCD"), "File was not patched as expected."
@@ -43,9 +20,13 @@ class PatchingTests < Test::Unit::TestCase
end
end
- def test_patch_list
+ def test_patch_array
shutup do
- ListPatchBall.new('test_patch_list').brew do
+ Class.new(TestBall) do
+ def patches
+ ["file:///#{TEST_FOLDER}/patches/noop-a.diff"]
+ end
+ end.new("test_patch_array").brew do
s = read_file 'libexec/NOOP'
assert !s.include?("NOOP"), "File was unpatched."
assert s.include?("ABCD"), "File was not patched as expected."
@@ -53,9 +34,13 @@ class PatchingTests < Test::Unit::TestCase
end
end
- def test_p0_patch
+ def test_patch_p0
shutup do
- P0PatchBall.new('test_p0_patch').brew do
+ Class.new(TestBall) do
+ def patches
+ "file:///#{TEST_FOLDER}/patches/noop-a.diff"
+ end
+ end.new("test_patch_p0").brew do
s = read_file 'libexec/NOOP'
assert !s.include?("NOOP"), "File was unpatched."
assert s.include?("ABCD"), "File was not patched as expected."
@@ -63,9 +48,13 @@ class PatchingTests < Test::Unit::TestCase
end
end
- def test_p1_patch
+ def test_patch_p1
shutup do
- P1PatchBall.new('test_p1_patch').brew do
+ Class.new(TestBall) do
+ def patches
+ { :p1 => ["file:///#{TEST_FOLDER}/patches/noop-a.diff"] }
+ end
+ end.new("test_patch_p1").brew do
s = read_file 'libexec/NOOP'
assert !s.include?("NOOP"), "File was unpatched."
assert s.include?("ABCD"), "File was not patched as expected."