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

GTest test does not appear in "Tests" sidebar

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • Qt Creator 4.15.0-rc1
    • Qt Creator 4.10.2, Qt Creator 4.11.2, Qt Creator 4.12.4, Qt Creator 4.13.3, Qt Creator 4.14.1, Qt Creator 4.15.0-beta1
    • None
    • Any
    • All
    • 5d5ff574953822043619c23f9b251016ac3357fe

    Description

      When test case starts with a number, test case does not appear in tests output pane:

      Minimum example:

      #include <gtest/gtest.h>
      #include <gmock/gmock-matchers.h>

      using namespace testing;

      class foo : public ::testing::Test
      {
      protected:
      void SetUp() override {}
      void TearDown() override {}
      };

      TEST_F(foo, 1bar)

      { EXPECT_EQ(1, 1); ASSERT_THAT(0, Eq(0)); }

       

      I have been looking in QtCreator code to see what is wrong, but I got stuck, and I do not know how to continue. It appears that in gtestvisitor.cc on line 48 is checking if symbol argumentCount() is 2. Seems like TEST_F is parsed here as function, and seems like this code checks that this function has 2 arguments. However, since this is not function, I am guessing that during parse its arguments get discarded because one of them starts with number, and argumentCount() on line 48 returns 0, so gtestvisitor skips the test case, and does not put it in "Tests" sidebar.

       

      Attachments

        For Gerrit Dashboard: QTCREATORBUG-25498
        # Subject Branch Project Status CR V

        Activity

          People

            cstenger Christian Stenger
            pperisin Petar
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes