Skip to content

Leading whitespace in test output unexpectedly stripped #437

Closed
@gavinltomra

Description

Checklist

  • The issue is about this extension and NOT about a fork.
  • Checked the ALL the SUPPORT document.
  • The latest version of the extension was used.
  • It is not related to remote-vscode or I checked the following issue
  • Imagine yourself into my position and think how hard to debug the issue without insufficient information.
    I understand that you have privacy concerns and I expect you to understand that this extension is developed for free.
    Thanks.

Describe the bug

Using a Google Test based test app, where one of the tests prints some additional information to std::cout on test failure, e.g.:

TEST(CppMateTest, LeadingWhitespace)
{
    std::cout << "First line\n"
              << "    Second line\n"
              << "- Third line\n"
              << "  Fourth line\n";
    FAIL() << "bad whitespace";
}

When run directly at the command prompt with --gtest_filter=CppMateTest*, the output is as expected:

[ RUN      ] CppMateTest.LeadingWhitespace
First line
    Second line
- Third line
  Fourth line
CppMateTest.cpp:27: Failure
Failed
bad whitespace
[  FAILED  ] CppMateTest.LeadingWhitespace (0 ms)

When run from VSCode's TESTING panel, the output in the TEST RESULTS panel strips the leading whitespace, like so:

$7│ [ RUN      ] CppMateTest.LeadingWhitespace
$7│ │ First line
$7│ │ Second line
$7│ │ - Third line
$7│ │ Fourth line
$7│ │ Failure @ /home/developer/CppMateTest/CppMateTest.cpp:27
$7│ │ Failed
$7│ │ bad whitespace
$7│ [  FAILED  ] CppMateTest.LeadingWhitespace (0 ms)

Also, if I click on the specific failing test in the panel on the right (rather than "show result output" on the whole run) then I only see the following output, which is not helpful:

# error: Failed:

Is this something that can be fixed in this extension or is it a bug in VSCode itself?
It would also be nice if there's a way to omit the prefixes so that it more closely matches the "real" output.

(Unrelated: if I click on a failing test in the TESTING panel then it navigates to the corresponding source. If I likewise click on a passing test then it doesn't. This seems unexpected. Possibly of note is that the TEST RESULTS panel displays two "go to source" context menu entries for failing tests (only the second of which works, and no run commands) and none for passing tests (only run/debug commands), which also seems unexpected.)

Desktop

  • Extension Version: 4.12.0
  • VS Code Version: 1.88.1
  • Catch2 / Google Test / DOCTest Version: gtest 1.8.0
  • OS Type and Version: Windows 11 host, OpenSUSE Leap 15.5 guest
  • Using remote-ssh/docker/wsl?: remote WSL

(This also reproduces outside of the remote, so I don't think that's related.)

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions