Don't return a version that equals the basename
Return nil instead
This commit is contained in:
parent
c532d11e7a
commit
f9d7b34945
@ -128,6 +128,8 @@ class Pathname
|
||||
stem.scan /_([^_]+)/ do |match|
|
||||
return match.first if /\d/.match $1
|
||||
end
|
||||
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user