2010-03-08 22:27:08 -08:00
|
|
|
require 'testing_env'
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2012-04-16 16:43:42 -05:00
|
|
|
def teardown
|
|
|
|
ARGV.reset
|
|
|
|
end
|
|
|
|
|
2010-03-08 22:27:08 -08:00
|
|
|
def test_ARGV
|
|
|
|
assert ARGV.named.empty?
|
2012-06-20 00:51:01 -05:00
|
|
|
|
2010-03-08 22:27:08 -08:00
|
|
|
(HOMEBREW_CELLAR+'mxcl/10.0').mkpath
|
2012-06-20 00:51:01 -05:00
|
|
|
|
2010-03-08 22:27:08 -08:00
|
|
|
ARGV.reset
|
|
|
|
ARGV.unshift 'mxcl'
|
|
|
|
assert_equal 1, ARGV.named.length
|
|
|
|
assert_equal 1, ARGV.kegs.length
|
|
|
|
assert_raises(FormulaUnavailableError) { ARGV.formulae }
|
|
|
|
end
|
2012-03-06 20:11:35 +00:00
|
|
|
|
|
|
|
def test_switch?
|
|
|
|
ARGV.unshift "-ns"
|
|
|
|
ARGV.unshift "-i"
|
|
|
|
ARGV.unshift "--bar"
|
|
|
|
assert ARGV.switch?('n')
|
|
|
|
assert ARGV.switch?('s')
|
|
|
|
assert ARGV.switch?('i')
|
|
|
|
assert !ARGV.switch?('b')
|
|
|
|
assert !ARGV.switch?('ns')
|
|
|
|
assert !ARGV.switch?('bar')
|
|
|
|
assert !ARGV.switch?('--bar')
|
|
|
|
assert !ARGV.switch?('-n')
|
|
|
|
end
|
|
|
|
|
2010-03-08 22:27:08 -08:00
|
|
|
end
|