Move ARGV tests to separate file.
This commit is contained in:
parent
551d42c6a9
commit
a7d74df430
35
Library/Homebrew/test/test_ARGV.rb
Normal file
35
Library/Homebrew/test/test_ARGV.rb
Normal file
@ -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
|
||||||
@ -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
|
# All other tests so far -- feel free to break them out into
|
||||||
# separate TestCase classes.
|
# separate TestCase classes.
|
||||||
|
|
||||||
@ -71,20 +74,6 @@ class BeerTasting < Test::Unit::TestCase
|
|||||||
# assert_equal 1, n
|
# assert_equal 1, n
|
||||||
# end
|
# 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
|
def test_brew_h
|
||||||
nostdout do
|
nostdout do
|
||||||
assert_nothing_raised do
|
assert_nothing_raised do
|
||||||
|
|||||||
@ -35,3 +35,6 @@ ruby test_pathname_install.rb $*
|
|||||||
|
|
||||||
# Test utility functions
|
# Test utility functions
|
||||||
ruby test_utils.rb $*
|
ruby test_utils.rb $*
|
||||||
|
|
||||||
|
# Test ARGV extensions
|
||||||
|
ruby test_ARGV.rb $*
|
||||||
|
|||||||
@ -93,15 +93,4 @@ class TestBallOverrideBrew <Formula
|
|||||||
end
|
end
|
||||||
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'
|
require 'test/test_bucket'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user