ParseSplitPaneIntoArgs unit test is failing #6241

Closed
opened 2026-01-31 00:33:13 +00:00 by claunia · 3 comments
Owner

Originally created by @j4james on GitHub (Feb 1, 2020).

Originally assigned to: @zadjii-msft on GitHub.

Environment

Windows build number: Version 10.0.18362.535
Windows Terminal version (if applicable): Commit 55b638801b

Steps to reproduce

  1. Build the OpenConsole solution.
  2. Run the unit tests with the runut.cmd script.

Expected behavior

All the tests should pass.

Actual behavior

The CommandlineTest::ParseSplitPaneIntoArgs test fails on line 593 with the message:

Error: Verify: AreEqual(SplitState::Vertical, myArgs.SplitStyle()) - Values (1, 4294967295) [File: \terminal\src\cascadia\LocalTests_TerminalApp\CommandlineTest.cpp, Function: TerminalAppLocalTests::CommandlineTest::ParseSplitPaneIntoArgs, Line: 593]
EndGroup: TerminalAppLocalTests::CommandlineTest::ParseSplitPaneIntoArgs [Failed]

That particular error looks to me like a mistake in the test itself. If the command line doesn't include a specific style, I would expect the style to be SplitState::Automatic. I'm guessing this is the result of a change in behavior as the code evolved. And I believe the tests on line 653 and line 707 will fail for the same reason.

Even with those cases fixed, though, there is still a failure which I think is an indication of a real bug in the code. The test on line 633 is failing because it's expecting the style to be Vertical but the return value is Automatic. The code that is to blame is in the AppCommandlineArgs::_buildSplitPaneParser method:

b6ec670bd8/src/cascadia/TerminalApp/AppCommandlineArgs.cpp (L220-L230)

There are two problems with this code. The first is that the initial branch isn't even passed unless _splitHorizontal is true, so the _splitVertical case is never handled. The second is that even with that fixed, the _splitVertical case will end up setting the style to Horizontal rather than Vertical.

Originally created by @j4james on GitHub (Feb 1, 2020). Originally assigned to: @zadjii-msft on GitHub. # Environment Windows build number: Version 10.0.18362.535 Windows Terminal version (if applicable): Commit 55b638801b0eac586f0a3db00e8a375655f8ead0 # Steps to reproduce 1. Build the _OpenConsole_ solution. 2. Run the unit tests with the `runut.cmd` script. # Expected behavior All the tests should pass. # Actual behavior The `CommandlineTest::ParseSplitPaneIntoArgs` test fails on [line 593](https://github.com/microsoft/terminal/blob/3487664cb0068d49b930e9524d1641bae55a32a9/src/cascadia/LocalTests_TerminalApp/CommandlineTest.cpp#L593) with the message: ``` Error: Verify: AreEqual(SplitState::Vertical, myArgs.SplitStyle()) - Values (1, 4294967295) [File: \terminal\src\cascadia\LocalTests_TerminalApp\CommandlineTest.cpp, Function: TerminalAppLocalTests::CommandlineTest::ParseSplitPaneIntoArgs, Line: 593] EndGroup: TerminalAppLocalTests::CommandlineTest::ParseSplitPaneIntoArgs [Failed] ``` That particular error looks to me like a mistake in the test itself. If the command line doesn't include a specific style, I would expect the style to be `SplitState::Automatic`. I'm guessing this is the result of a change in behavior as the code evolved. And I believe the tests on [line 653](https://github.com/microsoft/terminal/blob/3487664cb0068d49b930e9524d1641bae55a32a9/src/cascadia/LocalTests_TerminalApp/CommandlineTest.cpp#L653) and [line 707](https://github.com/microsoft/terminal/blob/3487664cb0068d49b930e9524d1641bae55a32a9/src/cascadia/LocalTests_TerminalApp/CommandlineTest.cpp#L707) will fail for the same reason. Even with those cases fixed, though, there is still a failure which I think is an indication of a real bug in the code. The test on [line 633](https://github.com/microsoft/terminal/blob/3487664cb0068d49b930e9524d1641bae55a32a9/src/cascadia/LocalTests_TerminalApp/CommandlineTest.cpp#L633) is failing because it's expecting the style to be `Vertical` but the return value is `Automatic`. The code that is to blame is in the `AppCommandlineArgs::_buildSplitPaneParser` method: https://github.com/microsoft/terminal/blob/b6ec670bd8cf8ac7f6f7e67ac28a0210ba56b2c8/src/cascadia/TerminalApp/AppCommandlineArgs.cpp#L220-L230 There are two problems with this code. The first is that the initial branch isn't even passed unless `_splitHorizontal` is true, so the `_splitVertical` case is never handled. The second is that even with that fixed, the `_splitVertical` case will end up setting the style to `Horizontal` rather than `Vertical`.
Author
Owner

@DHowett-MSFT commented on GitHub (Feb 7, 2020):

Yanking triage- i hit this as well, thanks for filing a followup

@DHowett-MSFT commented on GitHub (Feb 7, 2020): Yanking triage- i hit this as well, thanks for filing a followup
Author
Owner

@DHowett-MSFT commented on GitHub (Feb 7, 2020):

I've put a test bug into v1.0 because it's in a feature we added and are shipping, and we darn well better make sure it works right.

@DHowett-MSFT commented on GitHub (Feb 7, 2020): I've put a test bug into v1.0 because it's in a feature we added and are shipping, and we darn well better make sure it works right.
Author
Owner

@zadjii-msft commented on GitHub (Aug 21, 2020):

Hey I just ran this locally and it looks like we must have fixed this recently. Hard to say for sure, but I bet it was back when we made auto the default behavior.

Fortunately with #6992 set up, we'll be more diligent about these tests in the future. Thanks!

@zadjii-msft commented on GitHub (Aug 21, 2020): Hey I just ran this locally and it looks like we must have fixed this recently. Hard to say for sure, but I bet it was back when we made `auto` the default behavior. Fortunately with #6992 set up, we'll be more diligent about these tests in the future. Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#6241