Skip to content

Commit

Permalink
Add more test cases for bad index name
Browse files Browse the repository at this point in the history
  • Loading branch information
0rzech committed Dec 12, 2022
1 parent fa4eca6 commit ca5d04d
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions testsuite/tests/index/bad-name/test.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
"""
'''
Check that specifying a malformed index name is properly reported
"""
'''

import os.path

from drivers.alr import run_alr
from drivers.asserts import assert_match

def assert_that(name, fails_with):
p = run_alr('index', '--add', name, '--name', name, complain_on_error=False, debug=False)
assert_match(fails_with, p.out)

# < min length
assert_that(name='aa', fails_with='.*Identifier too short.*')

# > max length
assert_that(name='a' * 65, fails_with='.*Identifier too long.*')

# Leading underscore
assert_that(name='_aaa', fails_with='.*Identifiers must not begin with an underscore.*')

# Leading dot
assert_that(name='.aaa', fails_with='.*Identifiers must not begin with a dot.*')

p = run_alr('index', '--add', 'xx', '--name', 'xx',
complain_on_error=False, debug=False)
assert_match('.*Identifier too short.*', p.out)
# Non lowercase ASCII alnum
assert_that(name='aaą', fails_with='.*Identifiers must be lowercase ASCII alphanumerical.*')

print('SUCCESS')

0 comments on commit ca5d04d

Please sign in to comment.