aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/test
diff options
context:
space:
mode:
authorAdam Vandenberg2010-03-08 22:27:08 -0800
committerAdam Vandenberg2010-04-06 08:27:11 -0700
commita7d74df430a8dfba7bc701c5b526e5d2887c5e1c (patch)
tree16fc8fd0bc64395d1658c65cb3dda6132836c755 /Library/Homebrew/test
parent551d42c6a9a6f9d3c969b0eb8de28e0572c3d351 (diff)
downloadbrew-a7d74df430a8dfba7bc701c5b526e5d2887c5e1c.tar.bz2
Move ARGV tests to separate file.
Diffstat (limited to 'Library/Homebrew/test')
-rw-r--r--Library/Homebrew/test/test_ARGV.rb35
-rw-r--r--Library/Homebrew/test/test_bucket.rb17
-rwxr-xr-xLibrary/Homebrew/test/tests3
-rwxr-xr-xLibrary/Homebrew/test/unittest.rb11
4 files changed, 41 insertions, 25 deletions
diff --git a/Library/Homebrew/test/test_ARGV.rb b/Library/Homebrew/test/test_ARGV.rb
new file mode 100644
index 000000000..f6a74d45f
--- /dev/null
+++ b/Library/Homebrew/test/test_ARGV.rb
@@ -0,0 +1,35 @@
+require 'testing_env'
+
+require 'extend/ARGV' # needs to be after test/unit to avoid conflict with OptionsParser
+ARGV.extend(HomebrewArgvExtension)
+
+
+module ExtendArgvPlusYeast
+ def reset
+ @named = nil
+ @downcased_unique_named = nil
+ @formulae = nil
+ @kegs = nil
+ ARGV.shift while ARGV.length > 0
+ end
+end
+ARGV.extend ExtendArgvPlusYeast
+
+
+class ARGVTests < Test::Unit::TestCase
+
+ def test_ARGV
+ assert_raises(FormulaUnspecifiedError) { ARGV.formulae }
+ assert_raises(KegUnspecifiedError) { ARGV.kegs }
+ assert ARGV.named.empty?
+
+ (HOMEBREW_CELLAR+'mxcl/10.0').mkpath
+
+ ARGV.reset
+ ARGV.unshift 'mxcl'
+ assert_equal 1, ARGV.named.length
+ assert_equal 1, ARGV.kegs.length
+ assert_raises(FormulaUnavailableError) { ARGV.formulae }
+ end
+
+end
diff --git a/Library/Homebrew/test/test_bucket.rb b/Library/Homebrew/test/test_bucket.rb
index c93c5db39..46d24ec8b 100644
--- a/Library/Homebrew/test/test_bucket.rb
+++ b/Library/Homebrew/test/test_bucket.rb
@@ -1,3 +1,6 @@
+require 'extend/ARGV' # needs to be after test/unit to avoid conflict with OptionsParser
+ARGV.extend(HomebrewArgvExtension)
+
# All other tests so far -- feel free to break them out into
# separate TestCase classes.
@@ -71,20 +74,6 @@ class BeerTasting < Test::Unit::TestCase
# assert_equal 1, n
# end
- def test_ARGV
- assert_raises(FormulaUnspecifiedError) { ARGV.formulae }
- assert_raises(KegUnspecifiedError) { ARGV.kegs }
- assert ARGV.named.empty?
-
- (HOMEBREW_CELLAR+'mxcl/10.0').mkpath
-
- ARGV.reset
- ARGV.unshift 'mxcl'
- assert_equal 1, ARGV.named.length
- assert_equal 1, ARGV.kegs.length
- assert_raises(FormulaUnavailableError) { ARGV.formulae }
- end
-
def test_brew_h
nostdout do
assert_nothing_raised do
diff --git a/Library/Homebrew/test/tests b/Library/Homebrew/test/tests
index 44fba7a28..10cedae1e 100755
--- a/Library/Homebrew/test/tests
+++ b/Library/Homebrew/test/tests
@@ -35,3 +35,6 @@ ruby test_pathname_install.rb $*
# Test utility functions
ruby test_utils.rb $*
+
+# Test ARGV extensions
+ruby test_ARGV.rb $*
diff --git a/Library/Homebrew/test/unittest.rb b/Library/Homebrew/test/unittest.rb
index 8e850705d..546872954 100755
--- a/Library/Homebrew/test/unittest.rb
+++ b/Library/Homebrew/test/unittest.rb
@@ -93,15 +93,4 @@ class TestBallOverrideBrew <Formula
end
end
-module ExtendArgvPlusYeast
- def reset
- @named = nil
- @downcased_unique_named = nil
- @formulae = nil
- @kegs = nil
- ARGV.shift while ARGV.length > 0
- end
-end
-ARGV.extend ExtendArgvPlusYeast
-
require 'test/test_bucket'