Test curly quote characters in generated PowerShell scripts
What does this MR do?
Adds tests for how generated PowerShell scripts quote the curly quote characters. The fix to psSingleQuote is on main from !7709 (merged), so after the rebase this MR carries only tests:
- An integration test that passes each of the five single quote characters through
Command, two of them apart and two in a row, runs the generated script in PowerShell and compares how the parser read each argument. - Unit cases and an integration test for
Variable, which writes a double-quoted string. No test passed U+201C, U+201D or U+201E through it before.
Why was this MR needed?
The tests on main call psSingleQuote directly and pass one character through Command. The integration tests here run the generated script in PowerShell, so they check how its parser reads each argument and variable, not only the text the writer produces. The Command cases, with one and two characters, and the Variable cases for U+201C, U+201D and U+201E are what the review on !7004 (closed) asked for.
What's the best way to test this MR?
go test ./shells/ -count=1 -run 'Test_PsWriter_Variable'
go test -tags integration ./shells/ -count=1 -run 'TestPowershell_CommandKeepsSingleQuoteCharacters|TestPowershell_VariableKeepsQuoteCharacters'The integration tests need pwsh or powershell on PATH; each runs as a subtest per shell and skips the one that is missing. The canonical pipeline https://gitlab.com/gitlab-org/gitlab-runner/-/pipelines/3043871785 ran them in powershell and pwsh on Windows 1809 and 21H2, and in pwsh on Linux.
With shells/powershell.go from before !7709 (merged), the Command integration test fails. On main it passes, and so do the Variable tests, whose path did not change.
I also ran go test -race ./shells/..., go vet with and without -tags integration for Linux and GOOS=windows, and make lint in the runner-linters:2.14.0-go1.26.10 image the go:lint job uses.
What are the relevant issue numbers?
Closes https://gitlab.com/gitlab-org/gitlab-runner/-/issues/40154