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

Need problem matcher for Google Test #1079

Closed
rkeithhill opened this issue Sep 28, 2017 · 4 comments
Closed

Need problem matcher for Google Test #1079

rkeithhill opened this issue Sep 28, 2017 · 4 comments
Labels
Feature Request help wanted Can be fixed in the public (open source) repo. Language Service

Comments

@rkeithhill
Copy link

rkeithhill commented Sep 28, 2017

It seems that Google Test is pretty much the standard unit test framework for C++ these days. Could we get a problem matcher for gtest in this extension?

@bobbrow
Copy link
Member

bobbrow commented Oct 19, 2017

We don't use it internally here, but if you or someone else watching this thread wants to post some sample output, that would expedite cooking up a regular expression that meets your needs.

Defining a problem matcher is fairly easy once you know what the output is supposed to look like so if you or someone else wants to help with that, we would gladly include it in the extension.

@agauniyal
Copy link

gtest is by no means the standard unit test framework(not even crossed 50% yet), lots of other frameworks have a large number of users. See https://www.jetbrains.com/research/devecosystem-2017/cpp/ for more details. That said, having a matcher for gtest would be welcomed addition but I think the right way would to use XML output that gtest produces and mark the code(individual tests) as failing or passing inside the editor as well. Several IDEs already do that :p

@sean-mcmanus sean-mcmanus added help wanted Can be fixed in the public (open source) repo. and removed extension labels Dec 29, 2017
@kkaja123
Copy link

kkaja123 commented Jul 8, 2019

Here's a sample output:

[ RUN      ] TestSuite.TestCase1
[       OK ] TestSuite.TestCase1(0 ms)
[ RUN      ] TestSuite.TestCase2
C:\file\path\TestFile.cpp:547: Failure
Actual function call count doesn't match EXPECT_CALL(observer, HandleFunction(&argument))...
         Expected: to be called once
           Actual: never called - unsatisfied and active
[  FAILED  ] TestSuite.TestCase2(32 ms)
[ RUN      ] TestSuite.TestCase3
[       OK ] TestSuite.TestCase3(0 ms)

I've tried creating a problem matcher for this but I can't seem to get it right:

"problemMatcher": {
  "base": "$gcc",
  "owner": "cpp",
  "fileLocation": [
    "absolute"
  ],
  "pattern": [
    {
      "regexp": "^(.*):(\\d+):\\s+(Failure)$",
      "file": 1,
      "line": 2,
      "message": 3,
    }
  ]
}

or for multiline capturing:

"problemMatcher": {
  "base": "$gcc",
  "owner": "cpp",
  "fileLocation": [
    "absolute"
  ],
  "pattern": [
    {
      "regexp": "^(.*):(\\d+):\\s+(Failure)$",
      "file": 1,
      "line": 2,
      "severity": 3,
    },
    {
      "regexp": "^(?!\\[).*$",
      "message": 1,
      "loop": true,
    }
  ]
}

https://regex101.com/r/QbYxwf/1 shows that the main regex should be correct, but I don't see any problems generated after running the task.

@bobbrow
Copy link
Member

bobbrow commented Oct 30, 2019

Thank you for the feature suggestion. There are a few Google Test extensions available for VS Code now, and we believe that adding a problem matcher to those extensions is the better route.

@bobbrow bobbrow closed this as completed Oct 30, 2019
@github-actions github-actions bot locked and limited conversation to collaborators Oct 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Feature Request help wanted Can be fixed in the public (open source) repo. Language Service
Projects
None yet
Development

No branches or pull requests

5 participants