Skip to content

Add regression test for tool name in response file; drop outdated TODO#8447

Merged
Evangelink merged 3 commits into
mainfrom
copilot/fix-response-file-tool-name
May 22, 2026
Merged

Add regression test for tool name in response file; drop outdated TODO#8447
Evangelink merged 3 commits into
mainfrom
copilot/fix-response-file-tool-name

Conversation

Copilot AI commented May 21, 2026

Copy link
Copy Markdown
Contributor

Adds a regression test covering the case where the first argument provided to MTP is a response file whose contents include the tool name (mtp @tool.rsp with tool.rsp containing mytool --option1 a).

While investigating, it turned out the existing @-expansion logic already handles this correctly: the response-file branch does not flip isFirstRealArgument and does not advance past the expanded content, so the next loop iteration naturally picks up the first expanded token as the tool name. The TODO comment on Parser.cs claiming otherwise was outdated and has been removed.

Changes

  • Add regression test (31, ["@31_test.rsp"], ...) in CommandLineTests.ParserTestsData.
  • Remove the outdated TODO comment in Parser.cs.

No product logic change.

Copilot AI requested review from Copilot and removed request for Copilot May 21, 2026 08:05
Copilot AI linked an issue May 21, 2026 that may be closed by this pull request
Co-authored-by: Evangelink <11340282+Evangelink@users.noreply.github.com>
Copilot AI requested review from Copilot and removed request for Copilot May 21, 2026 08:14
Copilot AI changed the title [WIP] Fix response-file expansion to recognize tool name correctly Allow response files to provide MTP tool name May 21, 2026
Copilot AI requested a review from Evangelink May 21, 2026 08:14
@Evangelink
Evangelink marked this pull request as ready for review May 21, 2026 11:31
Copilot AI review requested due to automatic review settings May 21, 2026 11:32
@Evangelink

Copy link
Copy Markdown
Member

/review

@github-actions

github-actions Bot commented May 21, 2026

Copy link
Copy Markdown
Contributor

Expert Code Review (command) completed successfully!

Expert-reviewer launched in background for PR #8447. It will post the review directly.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes MTP command-line parsing so that a response file used as the first argument (mtp @tool.rsp) can supply the tool name from within the expanded contents, aligning response-file expansion with tool-name detection behavior.

Changes:

  • Expand @response-file contents in-place (replacing the @file token) to ensure the first expanded non-option token can be recognized as ToolName.
  • Add a regression unit test validating ToolName extraction and option parsing when argv[0] is a response file.
Show a summary per file
File Description
test/UnitTests/Microsoft.Testing.Platform.UnitTests/CommandLine/CommandLineTests.cs Adds regression coverage for tool-name detection when the first argument is a response file.
src/Platform/Microsoft.Testing.Platform/CommandLine/Parser.cs Adjusts response-file expansion to replace the @file token in-place so tool-name detection can see the first expanded token.

Copilot's findings

  • Files reviewed: 2/2 changed files
  • Comments generated: 0

Comment thread src/Platform/Microsoft.Testing.Platform/CommandLine/Parser.cs
The existing @-expansion logic already lands on the first expanded token on the next loop iteration (isFirstRealArgument stays true), so the new test passes without any product change. Just remove the now-incorrect TODO.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@Evangelink Evangelink changed the title Allow response files to provide MTP tool name Add regression test for tool name in response file; drop outdated TODO May 22, 2026
@Evangelink
Evangelink merged commit 1ff145c into main May 22, 2026
11 of 20 checks passed
@Evangelink
Evangelink deleted the copilot/fix-response-file-tool-name branch May 22, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MTP Core Analysis] Response-file expansion cannot supply the tool name

4 participants