Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leading whitespace in test output unexpectedly stripped #437

Closed
5 tasks done
gavinltomra opened this issue Jun 6, 2024 · 3 comments
Closed
5 tasks done

Leading whitespace in test output unexpectedly stripped #437

gavinltomra opened this issue Jun 6, 2024 · 3 comments

Comments

@gavinltomra
Copy link

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.)

@matepek
Copy link
Owner

matepek commented Oct 19, 2024

Hello,

Thanks for the report.

For the failure without message I can tell the problem is that there is a \n at the end of << " Fourth line\n";.
This changes the output from Failed bad whitespace to what you get.
It won't be fixed. There is no easy way to tell that what is the next line about. Note that this extension parses an unstructured output. Not trivial. related code

The other one I will try to fix it.

@matepek
Copy link
Owner

matepek commented Oct 19, 2024

Relates: #436

@matepek
Copy link
Owner

matepek commented Oct 19, 2024

Fixed in v4.12.1.

This issue was mentioned in CHANGELOG.md under a released entry so it is assumed to be fixed.
User verifications are always welcome.

@matepek matepek closed this as completed Oct 19, 2024
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

No branches or pull requests

2 participants