Another version test
This commit is contained in:
parent
0997a04bf8
commit
9003225a34
@ -57,15 +57,25 @@ end
|
||||
|
||||
# pass in the basename of the filename _without_ any file extension
|
||||
def extract_version basename
|
||||
# eg. foobar4.5.1
|
||||
# eg. foobar-4.5.1
|
||||
# eg. foobar-4.5.1b
|
||||
/^[^0-9]*((\d+\.)*(\d+-)?\d+[abc]?)$/.match basename
|
||||
# eg. boost_1_39_0
|
||||
/((\d+_)+\d+)$/.match basename
|
||||
return $1.gsub('_', '.') if $1
|
||||
|
||||
# eg. foobar-4.5.1-1
|
||||
/-((\d+\.)*\d+-\d+)$/.match basename
|
||||
return $1 if $1
|
||||
|
||||
# eg. boost_1_39_0
|
||||
/^[^0-9]*((\d+_)*\d+)$/.match basename
|
||||
return $1.gsub('_', '.') if $1
|
||||
# eg. foobar-4.5.1
|
||||
/-((\d+\.)*\d+)$/.match basename
|
||||
return $1 if $1
|
||||
|
||||
# eg. foobar-4.5.1b
|
||||
/-((\d+\.)*\d+[abc])$/.match basename
|
||||
return $1 if $1
|
||||
|
||||
# eg. foobar4.5.1
|
||||
/((\d+\.)*\d+)$/.match basename
|
||||
return $1 if $1
|
||||
|
||||
# eg. (erlang) otp_src_R13B
|
||||
/^.*[-_.](.*)$/.match basename
|
||||
|
@ -34,6 +34,11 @@ class BeerTasting <Test::Unit::TestCase
|
||||
assert_equal 'R13B', r.version
|
||||
end
|
||||
|
||||
def test_dos2unix
|
||||
r=TestFormula.new "http://www.sfr-fresh.com/linux/misc/dos2unix-3.1.tar.gz"
|
||||
assert_equal '3.1', r.version
|
||||
end
|
||||
|
||||
def test_version_internal_dash
|
||||
r=TestFormula.new "http://example.com/foo-arse-1.1-2.tar.gz"
|
||||
assert_equal '1.1-2', r.version
|
||||
|
Loading…
x
Reference in New Issue
Block a user