Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-15506

CMake: custom target output parsing for Visual C++ doesn't populate issues list

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Duplicate
    • Affects Version/s: Qt Creator 3.5.1, Qt Creator 4.0.0-beta1
    • Fix Version/s: None
    • Labels:
      None
    • Environment:
      Windows 10, Visual C++ 2013

      Description

      Given the following CMake project

      CMakeLists.txt
      cmake_minimum_required (VERSION 2.8)
      project (turtle-test)
      
      set (gtest_disable_pthreads on)
      
      add_subdirectory (googletest-master)
      config_compiler_and_linker()
      
      add_executable (${PROJECT_NAME} mock_turtle_test.cpp)
      target_link_libraries (${PROJECT_NAME} gtest gmock)
      
      add_custom_target(unittest ${PROJECT_NAME})
      
      mock_turtle_test.cpp
      #include <gmock/gmock.h>
      
      class Turtle
      {
      public:
          virtual ~Turtle() {};
          virtual void PenUp() = 0;
          virtual void PenDown() = 0;
          virtual void Forward(int distance) = 0;
          virtual void Turn(int degrees) = 0;
          virtual void GoTo(int x, int y) = 0;
          virtual int GetX() const = 0;
          virtual int GetY() const = 0;
      };
      
      class MockTurtle : public Turtle
      {
      public:
          MOCK_METHOD0(PenUp, void());
          MOCK_METHOD0(PenDown, void());
          MOCK_METHOD1(Forward, void(int distance));
          MOCK_METHOD1(Turn, void(int degrees));
          MOCK_METHOD2(GoTo, void(int x, int y));
          MOCK_CONST_METHOD0(GetX, int());
          MOCK_CONST_METHOD0(GetY, int());
      };
      
      class Painter
      {
          Turtle* turtle;
      public:
          Painter(Turtle* turtle) : turtle(turtle)
          {
          }
      
          bool DrawCircle(int x, int y, int)
          {
              turtle->GoTo(x, y);
              turtle->PenDown();
      
              return true;
          }
      };
      
      TEST(PainterTest, CanDrawSomething)
      {
          MockTurtle turtle;
      
          // Set expectations
          EXPECT_CALL(turtle, GoTo(100, 50));
          EXPECT_CALL(turtle, PenDown());
      
          // Call sequence
          Painter painter(&turtle);
      
          EXPECT_TRUE(painter.DrawCircle(101, 50, 10));
      }
      
      int main(int argc, char** argv)
      {
          testing::InitGoogleMock(&argc, argv);
          return RUN_ALL_TESTS();
      }
      

      googletest-master was taken from Google Test github master

      The failing test is highlighted in the output command line. But when the cm unittest is run in the Issues list is empty!

      I would have expected a red error icon at line 50 in mock_turtle_test.cpp and the issues list populated with the errors.

      See QTCREATORBUG-15505 for a similar issue with MinGW.

        Attachments

        1. gmock_visualc++_fail.png
          85 kB
          Cristian Adam
        2. gmock_visualc++_test.png
          71 kB
          Cristian Adam

          Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            Activity

              People

              Assignee:
              hunger Tobias Hunger
              Reporter:
              cadam Cristian Adam
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes