Skip to content
Snippets Groups Projects
Commit d87023a7 authored by ulif's avatar ulif
Browse files

Add tests for numbered wordlists with dashes.

Yet in numbered wordlists we expect numbers like ``123456``, each
digit representing a dice number. When using dice with more than 9
sides, we have to separate single numbers. This separator must be a
single dash.

We allow '123456' as well as '1-2-3-4-5-6'. Or '12-3-4-5-6'. But not
'-1-2-3-4' nor '1-2-2--3' (double dash).
parent 0b418c25
No related branches found
No related tags found
No related merge requests found
......@@ -39,15 +39,27 @@ class TestWordlistModule(object):
assert RE_WORDLIST_NAME.match('with/slash') is None
def test_re_numbered_wordlist_entry(self):
# we accept numbers (optionally separated by single dashes) in
# wordlist lines
#
# valid stuff
assert RE_NUMBERED_WORDLIST_ENTRY.match('11111 a') is not None
assert RE_NUMBERED_WORDLIST_ENTRY.match('1-2-2-11 1') is not None
assert RE_NUMBERED_WORDLIST_ENTRY.match(
'11111 a').groups() == ('a', )
'11111 a').groups() == (None, 'a', )
assert RE_NUMBERED_WORDLIST_ENTRY.match('12211\t 1') is not None
assert RE_NUMBERED_WORDLIST_ENTRY.match(
'12211\t 1').groups() == ('1', )
'12211\t 1').groups() == (None, '1', )
assert RE_NUMBERED_WORDLIST_ENTRY.match(
'1-2-2-1-1\t 1-1').groups()[1] == '1-1'
# invalid stuff
assert RE_NUMBERED_WORDLIST_ENTRY.match('12a11 foo') is None
assert RE_NUMBERED_WORDLIST_ENTRY.match('12--11 foo') is None
assert RE_NUMBERED_WORDLIST_ENTRY.match('1211- foo') is None
assert RE_NUMBERED_WORDLIST_ENTRY.match('-1211 foo') is None
assert RE_NUMBERED_WORDLIST_ENTRY.match('foo bar') is None
def test_re_valid_wordlist_filename(self):
# RE_VALID_WORDLIST_FILENAME really detects filenames we allow
# Valid filenames
......
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