-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add more test cases for bad index name
- Loading branch information
Showing
1 changed file
with
21 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |