diff options
| author | Max Howell | 2009-08-07 15:49:58 +0100 |
|---|---|---|
| committer | Max Howell | 2009-08-10 18:11:23 +0100 |
| commit | 6dbdc9ab0c5c87d94569bb418c4838edceff09b7 (patch) | |
| tree | 275819f4cc0b9b5bbc534a657e77b93eff7a0317 /Library | |
| parent | dccc2b192328e864b2bdb1b6758e0b4315cf0cfc (diff) | |
| download | brew-6dbdc9ab0c5c87d94569bb418c4838edceff09b7.tar.bz2 | |
Remove duplicates from ARGV.named
Includes test
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/ARGV+yeast.rb | 2 | ||||
| -rwxr-xr-x | Library/Homebrew/unittest.rb | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/Library/Homebrew/ARGV+yeast.rb b/Library/Homebrew/ARGV+yeast.rb index 92d341254..c61e2d2c2 100644 --- a/Library/Homebrew/ARGV+yeast.rb +++ b/Library/Homebrew/ARGV+yeast.rb @@ -17,7 +17,7 @@ # module HomebrewArgvExtension def named - reject {|arg| arg[0..0] == '-'} + reject{|arg| arg[0..0] == '-'}.collect{|arg| arg.downcase}.uniq end def options select {|arg| arg[0..0] == '-'} diff --git a/Library/Homebrew/unittest.rb b/Library/Homebrew/unittest.rb index 1bee7b3a6..d4339ebad 100755 --- a/Library/Homebrew/unittest.rb +++ b/Library/Homebrew/unittest.rb @@ -255,4 +255,12 @@ class BeerTasting <Test::Unit::TestCase assert_raises(RuntimeError) { f.prefix } nostdout { assert_raises(ExecutionError) { f.brew } } end + + def test_no_ARGV_dupes + ARGV.unshift'foo' + ARGV.unshift'foo' + n=0 + ARGV.named.each{|arg| n+=1 if arg == 'foo'} + assert_equal 1, n + end end |
