Skip to content

Commit 02e2c1b

Browse files
test(scripts): cover the ASCII acronym boundary in the PowerShell twins
The ASCII-lookaround fix in scripts/powershell/create-new-feature.ps1 and extensions/git/scripts/powershell/create-new-feature-branch.ps1 had no PowerShell regression coverage: the accented-acronym parity cases invoked only bash and Python, and the existing PowerShell acronym tests used ASCII-separated words, so a regression there would have passed CI. Adds a three-way bash/Python/pwsh assertion for 'Fix eDBe sync' in the core parity suite and a pwsh arm to the extension parity test, both asserting 001-fix-db-sync.
1 parent 20827ec commit 02e2c1b

2 files changed

Lines changed: 32 additions & 0 deletions

File tree

‎tests/extensions/git/test_git_extension_python_parity.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020
from tests.parity_helpers import collation_range_locale
2121
from tests.extensions.git.test_git_extension import (
2222
_GIT_ENV,
23+
HAS_PWSH,
2324
_init_git,
2425
_run_bash,
26+
_run_pwsh,
2527
_setup_project,
2628
_write_config,
2729
)
@@ -169,6 +171,16 @@ def test_acronym_adjacent_to_non_ascii_matches_python(
169171
)
170172
_assert_parity(b, p)
171173

174+
if not HAS_PWSH:
175+
pytest.skip("pwsh not available")
176+
ps_proj = _setup_project(tmp_path / "ps" / "proj")
177+
ps = _run_pwsh(
178+
"create-new-feature-branch.ps1", ps_proj,
179+
"-Json", "-DryRun", description,
180+
)
181+
assert ps.returncode == 0, ps.stderr
182+
assert json.loads(ps.stdout) == json.loads(b.stdout)
183+
172184
@pytest.mark.parametrize(
173185
("short_name", "expected"),
174186
[

‎tests/test_create_new_feature_python_parity.py‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,26 @@ def test_python_branch_name_generation_matches_bash(
143143
assert json_stdout(py) == json_stdout(bash)
144144

145145

146+
@requires_bash
147+
@pytest.mark.skipif(not HAS_POWERSHELL, reason="no PowerShell available")
148+
def test_all_variants_keep_acronym_next_to_non_ascii(repo: Path) -> None:
149+
"""An acronym touching an accented letter survives in all three twins.
150+
151+
bash probes for acronyms with `grep -qw` under LC_ALL=C, where an accented
152+
letter is a non-word byte and therefore a boundary. Python's \\b and .NET's
153+
\\b are Unicode-aware and saw "\u00e9DB\u00e9" as a single word, dropping the
154+
acronym; all three now spell the boundary out as ASCII.
155+
"""
156+
description = "Fix \u00e9DB\u00e9 sync"
157+
bash = run(bash_cmd(repo, SCRIPT, "--json", "--dry-run", description), repo)
158+
py = run(py_cmd(repo, SCRIPT, "--json", "--dry-run", description), repo)
159+
ps = run(ps_cmd(repo, SCRIPT, "-Json", "-DryRun", description), repo)
160+
161+
assert bash.returncode == py.returncode == ps.returncode == 0
162+
assert json_stdout(py) == json_stdout(bash) == json_stdout(ps)
163+
assert json_stdout(ps)["BRANCH_NAME"] == "001-fix-db-sync"
164+
165+
146166
@requires_bash
147167
@pytest.mark.parametrize(
148168
"args",

0 commit comments

Comments
 (0)