2
# arch-tag: 707bdb87-bc61-4d5d-9cd1-489aeb329951
3
# Copyright (C) 2004 Johannes Berg <johannes@sipsolutions.de>
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 2 of the License, or
8
# (at your option) any later version.
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
15
# You should have received a copy of the GNU General Public License
16
# along with this program; if not, write to the Free Software
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
## package parsing tests ##
21
from arch.pathname import NameParser, ForkNameParser
25
archives = ['arch@arch.thinkmo.de--2003-archives', 'archo--dummy', '',
26
'arch@arch.org--archie--dada--dudu', '1@']
27
categories = ['moin', 'test-test',] # known to fail, tla bug: 'yadda-'
28
branches = ['', 'cvs','test-test-test','test--test--test','#++','emacs+junk']
29
versions = ['1.1', '1.2.3.4.5.6.7', '0', 'a', 'a.b.c.d',]
30
levels = ['patch-1321', 'base-0', 'version-0', 'versionfix-209', 'vsn-12',
31
'a', 'version-1', 'version-1.2.3',]
39
_categories = _categories + [i+'/'+j]
41
_categories = _categories + [j]
47
_branches = _branches + [i+'--'+j]
49
_branches = _branches + [i]
54
_versions = _versions + [i+'--'+j]
59
_levels = _levels + [i+'--'+j]
76
np = NameParser.__dict__.get(fct)(NameParser(i))
77
fnp = ForkNameParser.__dict__.get(fct)(ForkNameParser(i))
79
print 'NP ',i,fct,'=',np
80
print 'FNP ',i,fct,'=',fnp
81
if np != fnp: print '*****',i,fct,'mismatches:',np,fnp
84
for fct in ['archive', 'nonarch', 'category', 'branch',
85
'package', 'version', 'patchlevel']:
86
for type in [_categories, _branches, _versions, _levels]:
87
test('get_'+fct, type)
89
for pre in ['is', 'has']:
90
for fct in ['category', 'package', 'version', 'patchlevel']:
91
if (pre, fct) == ('is', 'patchlevel'): continue
92
for type in [_categories, _branches, _versions, _levels]:
93
test(pre+'_'+fct, type)
95
print 'Done',count,'tests.'