mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
New test for Boost version style
1_39_0 becomes 1.39.0
This commit is contained in:
parent
bdc02ad696
commit
bff155932d
@ -44,8 +44,10 @@ class Formula
|
||||
filename=File.basename url
|
||||
i=filename.index /[-_]\d/
|
||||
unless i.nil?
|
||||
/^((\d+[.-])*\d+)/.match filename[i+1,1000] #1000 because rubysucks
|
||||
@version = $1
|
||||
/^((\d+[._])*(\d+-)?\d+)/.match filename[i+1,1000] #1000 because rubysucks
|
||||
@version=$1
|
||||
# if there are no dots replace underscores, boost do this, the bastards!
|
||||
@version.gsub!('_', '.') unless @version.include? '.'
|
||||
else
|
||||
# no divisor or a '.' divisor, eg. dmd.1.11.zip
|
||||
/^[a-zA-Z._-]*((\d+\.)*\d+)/.match filename
|
||||
|
@ -16,6 +16,11 @@ class BeerTasting < Test::Unit::TestCase
|
||||
assert_equal '1.1', r.version
|
||||
end
|
||||
|
||||
def test_version_underscores_all_the_way
|
||||
r=Formula.new "http://example.com/boost_1_39_0.tar.bz2", 'nomd5'
|
||||
assert_equal '1.39.0', r.version
|
||||
end
|
||||
|
||||
def test_version_internal_dash
|
||||
r=Formula.new "http://example.com/foo-arse-1.1-2.tar.gz", 'nomd5'
|
||||
assert_equal '1.1-2', r.version
|
||||
|
Loading…
x
Reference in New Issue
Block a user