Skip to content
Snippets Groups Projects
Commit bff15593 authored by Max Howell's avatar Max Howell
Browse files

New test for Boost version style

1_39_0 becomes 1.39.0
parent bdc02ad6
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment