diff options
| author | Max Howell | 2009-08-22 15:53:35 +0100 |
|---|---|---|
| committer | Max Howell | 2009-08-24 01:04:53 +0100 |
| commit | f9d7b34945d48f7a954cc9fad2696ece718d0daf (patch) | |
| tree | 8efcd5e129e5512c48fcd15209433c213bf5e3eb /Library | |
| parent | c532d11e7aab8821a4e548208d5ef09c42d77e86 (diff) | |
| download | brew-f9d7b34945d48f7a954cc9fad2696ece718d0daf.tar.bz2 | |
Don't return a version that equals the basename
Return nil instead
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/pathname+yeast.rb | 4 | ||||
| -rwxr-xr-x | Library/Homebrew/unittest.rb | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/Library/Homebrew/pathname+yeast.rb b/Library/Homebrew/pathname+yeast.rb index f0ca0f503..1c7b9794d 100644 --- a/Library/Homebrew/pathname+yeast.rb +++ b/Library/Homebrew/pathname+yeast.rb @@ -98,7 +98,7 @@ class Pathname # we only support numbered tagged downloads %r[github.com/.*/tarball/((\d\.)+\d)$].match to_s return $1 if $1 - + # eg. boost_1_39_0 /((\d+_)+\d+)$/.match stem return $1.gsub('_', '.') if $1 @@ -128,6 +128,8 @@ class Pathname stem.scan /_([^_]+)/ do |match| return match.first if /\d/.match $1 end + + nil end end diff --git a/Library/Homebrew/unittest.rb b/Library/Homebrew/unittest.rb index 4e387bcbf..65ac81d87 100755 --- a/Library/Homebrew/unittest.rb +++ b/Library/Homebrew/unittest.rb @@ -196,6 +196,11 @@ class BeerTasting <Test::Unit::TestCase end end + def test_no_version + assert_nil Pathname.new("http://example.com/blah.tar").version + assert_nil Pathname.new("arse").version + end + def test_bad_version assert_raises(RuntimeError) {f=TestBadVersion.new} end |
