filter-repo: add tests triggering callback sanity checks

Signed-off-by: Elijah Newren <newren@gmail.com>
This commit is contained in:
Elijah Newren 2019-03-13 20:19:24 -07:00
parent dd4f3bd111
commit 30228bdde2
3 changed files with 37 additions and 0 deletions

View File

@ -141,4 +141,14 @@ test_expect_success 'unusual.py' '
)
'
test_expect_success 'erroneous.py' '
setup erroneous &&
(
cd erroneous &&
test_must_fail $TEST_DIRECTORY/t9391/erroneous.py 2>../err &&
test_i18ngrep "Error: Cannot pass a tag_callback to RepoFilter AND pass --tag-callback" ../err
)
'
test_done

16
t/t9391/erroneous.py Executable file
View File

@ -0,0 +1,16 @@
#!/usr/bin/env python
"""
Please see the
***** API BACKWARD COMPATIBILITY CAVEAT *****
near the top of git-filter-repo
"""
import git_filter_repo as fr
def handle_tag(tag):
print("Decipher this: "+''.join(reversed(progress.message)))
args = fr.FilteringOptions.parse_args(['--force', '--tag-callback', 'pass'])
filter = fr.RepoFilter(args, tag_callback = handle_tag)
filter.run()

View File

@ -170,4 +170,15 @@ test_expect_success '--reset-callback' '
)
'
test_expect_success 'callback has return statement sanity check' '
setup callback_return_sanity &&
(
cd callback_return_sanity &&
test_must_fail git filter-repo --filename-callback "filename + \".txt\"" 2>../err&&
test_i18ngrep "Error: --filename-callback should have a return statement" ../err &&
rm ../err
)
'
test_done