mirror of
https://github.com/newren/git-filter-repo.git
synced 2024-07-06 18:32:14 +02:00
filter-repo: add tests triggering callback sanity checks
Signed-off-by: Elijah Newren <newren@gmail.com>
This commit is contained in:
parent
dd4f3bd111
commit
30228bdde2
@ -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
|
test_done
|
||||||
|
16
t/t9391/erroneous.py
Executable file
16
t/t9391/erroneous.py
Executable 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()
|
@ -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
|
test_done
|
||||||
|
Loading…
Reference in New Issue
Block a user