From e8da696285da58783f7c6519d81276ecad4f4e0b Mon Sep 17 00:00:00 2001 From: Piotr Orzechowski Date: Mon, 12 Dec 2022 02:34:10 +0100 Subject: [PATCH] Add more test cases for bad index name --- testsuite/tests/index/bad-name/test.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/testsuite/tests/index/bad-name/test.py b/testsuite/tests/index/bad-name/test.py index e0d3b563a..e237a15c2 100644 --- a/testsuite/tests/index/bad-name/test.py +++ b/testsuite/tests/index/bad-name/test.py @@ -1,13 +1,27 @@ -""" +''' Check that specifying a malformed index name is properly reported -""" +''' 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) -p = run_alr('index', '--add', 'xx', '--name', 'xx', - complain_on_error=False, debug=False) -assert_match('.*Identifier too short.*', 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.*') + +# Non lowercase ASCII alnum +assert_that(name='aaą', fails_with='.*Identifiers must be lowercase ASCII alphanumerical.*') print('SUCCESS')