aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2020-07-03 16:35:49 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2020-07-06 06:32:33 +0000
commit15a1266d501829e9c5d1ca6a0fa3ba3effe455d9 (patch)
treef887bdb28588a82dc88bfd476aaa0267401cac29 /tests
parent4c2938a366ca1dbe44c779471503ef57de149651 (diff)
clangbackend: Do not handle built-in types specially
... when collecing tooltips. The more general functions provide more information, such as constness. Fixes: QTCREATORBUG-14950 Change-Id: I6d0a890a695e19e9754b5538ba092a188a3bbbb0 Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/unit/unittest/clangtooltipinfo-test.cpp10
-rw-r--r--tests/unit/unittest/data/tooltipinfo.cpp8
2 files changed, 18 insertions, 0 deletions
diff --git a/tests/unit/unittest/clangtooltipinfo-test.cpp b/tests/unit/unittest/clangtooltipinfo-test.cpp
index 26b6596cc5..0c9db57dc3 100644
--- a/tests/unit/unittest/clangtooltipinfo-test.cpp
+++ b/tests/unit/unittest/clangtooltipinfo-test.cpp
@@ -115,6 +115,16 @@ TEST_F(ToolTipInfo, LocalVariableInt)
ASSERT_THAT(actual, IsToolTip(::ToolTipInfo(Utf8StringLiteral("int"))));
}
+TEST_F(ToolTipInfo, LocalVariableConstInt)
+{
+ ASSERT_THAT(tooltip(211, 19), IsToolTip(::ToolTipInfo(Utf8StringLiteral("const int"))));
+}
+
+TEST_F(ToolTipInfo, FileScopeVariableConstInt)
+{
+ ASSERT_THAT(tooltip(206, 11), IsToolTip(::ToolTipInfo(Utf8StringLiteral("const int"))));
+}
+
TEST_F(ToolTipInfo, LocalVariablePointerToConstInt)
{
const ::ToolTipInfo actual = tooltip(4, 5);
diff --git a/tests/unit/unittest/data/tooltipinfo.cpp b/tests/unit/unittest/data/tooltipinfo.cpp
index 6844a823cc..bc1f17066e 100644
--- a/tests/unit/unittest/data/tooltipinfo.cpp
+++ b/tests/unit/unittest/data/tooltipinfo.cpp
@@ -202,3 +202,11 @@ Nuu **pointers(Nuu **p1)
static constexpr int calcValue() { return 1 + 2; }
const auto val = calcValue() + sizeof(char);
+
+const int zero = 0;
+
+static void func()
+{
+ const int i = 5;
+ const int j = i;
+}