Find version number in *-src.tarball

Signed-Off-By: Max Howell <max@methylblue.com>

I added a unittest.
This commit is contained in:
Adam Vandenberg 2009-09-23 07:56:07 -07:00 committed by Max Howell
parent 235987b032
commit a3668bef76
2 changed files with 9 additions and 3 deletions

View File

@ -142,7 +142,7 @@ class Pathname
return $1 if $1 return $1 if $1
# eg foobar-4.5.0-bin # eg foobar-4.5.0-bin
/-((\d+\.)*\d+-bin)$/.match stem /-((\d+\.)+\d+)-(bin|src)$/.match stem
return $1 if $1 return $1 if $1
# eg. otp_src_R13B (this is erlang's style) # eg. otp_src_R13B (this is erlang's style)

View File

@ -21,6 +21,7 @@ HOMEBREW_PREFIX=Pathname.new '/private/tmp/testbrew/prefix'
HOMEBREW_CACHE=HOMEBREW_PREFIX.parent+"cache" HOMEBREW_CACHE=HOMEBREW_PREFIX.parent+"cache"
HOMEBREW_CELLAR=HOMEBREW_PREFIX.parent+"cellar" HOMEBREW_CELLAR=HOMEBREW_PREFIX.parent+"cellar"
HOMEBREW_USER_AGENT="Homebrew" HOMEBREW_USER_AGENT="Homebrew"
MACOS_VERSION=10.6
(HOMEBREW_PREFIX+'Library'+'Formula').mkpath (HOMEBREW_PREFIX+'Library'+'Formula').mkpath
Dir.chdir HOMEBREW_PREFIX Dir.chdir HOMEBREW_PREFIX
@ -507,6 +508,11 @@ class BeerTasting <Test::Unit::TestCase
assert_raises(RuntimeError) {Pathname.getwd.install 'non_existant_file'} assert_raises(RuntimeError) {Pathname.getwd.install 'non_existant_file'}
end end
def test_omega_version_style
f=MockFormula.new 'http://www.alcyone.com/binaries/omega/omega-0.80.2-src.tar.gz'
assert_equal '0.80.2', f.version
end
def test_formula_class_func def test_formula_class_func
assert_equal Formula.class_s('s-lang'), 'SLang' assert_equal Formula.class_s('s-lang'), 'SLang'
assert_equal Formula.class_s('pkg-config'), 'PkgConfig' assert_equal Formula.class_s('pkg-config'), 'PkgConfig'