diff options
| author | Xu Cheng | 2016-02-26 16:10:48 +0800 |
|---|---|---|
| committer | Xu Cheng | 2016-02-26 16:50:55 +0800 |
| commit | 73b79de7bcd97e10c8d3719988bf08f94373872f (patch) | |
| tree | 3f6de3a0d3e57c4a40beb2b066737bec049d8dff /Library/Homebrew/test | |
| parent | ba147818cb4144e579a35cac949ca97b1253d50e (diff) | |
| download | brew-73b79de7bcd97e10c8d3719988bf08f94373872f.tar.bz2 | |
ARGV: switch? should only has one dash
If user inputs argument such as `-with-flag`, we can assume it's a bad flag.
Closes Homebrew/homebrew#49256
Closes Homebrew/homebrew#49550.
Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library/Homebrew/test')
| -rw-r--r-- | Library/Homebrew/test/test_ARGV.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Library/Homebrew/test/test_ARGV.rb b/Library/Homebrew/test/test_ARGV.rb index 4dc3f2677..39f32f452 100644 --- a/Library/Homebrew/test/test_ARGV.rb +++ b/Library/Homebrew/test/test_ARGV.rb @@ -48,9 +48,9 @@ class ArgvExtensionTests < Homebrew::TestCase end def test_switch? - @argv << "-ns" << "-i" << "--bar" + @argv << "-ns" << "-i" << "--bar" << "-a-bad-arg" %w[n s i].each { |s| assert @argv.switch?(s) } - %w[b ns bar --bar -n].each { |s| assert !@argv.switch?(s) } + %w[b ns bar --bar -n a bad arg].each { |s| assert !@argv.switch?(s) } end def test_flag? |
