Add test for ARGV.flag?

This commit is contained in:
Jack Nagel 2013-05-20 22:34:53 -05:00
parent 007d174f43
commit 863d2b253a

View File

@ -38,6 +38,16 @@ class ArgvExtensionTests < Test::Unit::TestCase
%w{b ns bar --bar -n}.each { |s| assert !@argv.switch?(s) }
end
def test_flag?
@argv << "--foo" << "-bq" << "--bar"
assert @argv.flag?("--foo")
assert @argv.flag?("--bar")
assert @argv.flag?("--baz")
assert @argv.flag?("--qux")
assert !@argv.flag?("--frotz")
assert !@argv.flag?("--debug")
end
def test_filter_for_dependencies_clears_flags
@argv << "--debug"
@argv.filter_for_dependencies { assert @argv.empty? }