diff options
| author | Junio C Hamano <gitster@pobox.com> | 2026-02-27 15:11:53 -0800 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2026-02-27 15:11:53 -0800 |
| commit | c0d0b8daedd336677ed30bfb6bb7cdc6c47a468a (patch) | |
| tree | 0a35c3e3b9065c7bd1714f56a4eb624ad4c185b8 /t | |
| parent | ac78c5804e080aa8f0307155eda85465a2a1b1dd (diff) | |
| parent | edd8ad18a643d47dd92b08ab865bf7f4a26f50bc (diff) | |
| download | git-c0d0b8daedd336677ed30bfb6bb7cdc6c47a468a.tar.xz | |
Merge branch 'jh/alias-i18n'
Extend the alias configuration syntax to allow aliases using
characters outside ASCII alphanumeric (plus '-').
* jh/alias-i18n:
completion: fix zsh alias listing for subsection aliases
alias: support non-alphanumeric names via subsection syntax
alias: prepare for subsection aliases
help: use list_aliases() for alias listing
Diffstat (limited to 't')
| -rwxr-xr-x | t/t0014-alias.sh | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/t/t0014-alias.sh b/t/t0014-alias.sh index 07a53e7366..34bbdb51c5 100755 --- a/t/t0014-alias.sh +++ b/t/t0014-alias.sh @@ -112,4 +112,75 @@ test_expect_success 'cannot alias-shadow a sample of regular builtins' ' done ' +test_expect_success 'alias without value reports error' ' + test_when_finished "git config --unset alias.noval" && + cat >>.git/config <<-\EOF && + [alias] + noval + EOF + test_must_fail git noval 2>error && + test_grep "alias.noval" error +' + +test_expect_success 'subsection syntax works' ' + test_config alias.testnew.command "!echo ran-subsection" && + git testnew >output && + test_grep "ran-subsection" output +' + +test_expect_success 'subsection syntax only accepts command key' ' + test_config alias.invalid.notcommand value && + test_must_fail git invalid 2>error && + test_grep -i "not a git command" error +' + +test_expect_success 'subsection syntax requires value for command' ' + test_when_finished "git config --remove-section alias.noval" && + cat >>.git/config <<-\EOF && + [alias "noval"] + command + EOF + test_must_fail git noval 2>error && + test_grep "alias.noval.command" error +' + +test_expect_success 'simple syntax is case-insensitive' ' + test_config alias.LegacyCase "!echo ran-legacy" && + git legacycase >output && + test_grep "ran-legacy" output +' + +test_expect_success 'subsection syntax is case-sensitive' ' + test_config alias.SubCase.command "!echo ran-upper" && + test_config alias.subcase.command "!echo ran-lower" && + git SubCase >upper.out && + git subcase >lower.out && + test_grep "ran-upper" upper.out && + test_grep "ran-lower" lower.out +' + +test_expect_success 'UTF-8 alias with Swedish characters' ' + test_config alias."förgrena".command "!echo ran-swedish" && + git förgrena >output && + test_grep "ran-swedish" output +' + +test_expect_success 'UTF-8 alias with CJK characters' ' + test_config alias."分支".command "!echo ran-cjk" && + git 分支 >output && + test_grep "ran-cjk" output +' + +test_expect_success 'alias with spaces in name' ' + test_config alias."test name".command "!echo ran-spaces" && + git "test name" >output && + test_grep "ran-spaces" output +' + +test_expect_success 'subsection aliases listed in help -a' ' + test_config alias."förgrena".command "!echo test" && + git help -a >output && + test_grep "förgrena" output +' + test_done |
