summaryrefslogtreecommitdiff
path: root/src/plugins/cppeditor/cppincludehierarchy_test.cpp
diff options
context:
space:
mode:
authorPrzemyslaw Gorszkowski <pgorszkowski@gmail.com>2014-02-20 14:36:14 +0100
committerPrzemyslaw Gorszkowski <pgorszkowski@gmail.com>2014-02-27 09:02:30 +0100
commita7bd805e3394676327df5756b93a28ad83ac046a (patch)
tree530e629e9677c66c3262ee7a98a07ae61141f231 /src/plugins/cppeditor/cppincludehierarchy_test.cpp
parentb33c3c88f7003a54dfcd7c34b887f65239bb7b1b (diff)
downloadqt-creator-a7bd805e3394676327df5756b93a28ad83ac046a.tar.gz
CppTools: fix showing cyclic in a wrong level of IncludeHierarchy
File path for which we build hierarchy was not consider in cyclic checking. Added tests for cyclic cases Change-Id: I0c2e60034c6e8f3aa69ab723350b4c05530fcdfb Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Diffstat (limited to 'src/plugins/cppeditor/cppincludehierarchy_test.cpp')
-rw-r--r--src/plugins/cppeditor/cppincludehierarchy_test.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/plugins/cppeditor/cppincludehierarchy_test.cpp b/src/plugins/cppeditor/cppincludehierarchy_test.cpp
index d0713209e5..d37448dd16 100644
--- a/src/plugins/cppeditor/cppincludehierarchy_test.cpp
+++ b/src/plugins/cppeditor/cppincludehierarchy_test.cpp
@@ -143,6 +143,35 @@ void CppEditorPlugin::test_includehierarchy_data()
"Included by\n"
" file3.h\n"
);
+
+ QTest::newRow("simple-cyclic")
+ << (QList<QByteArray>()
+ << QByteArray("#include \"file2.h\"\n")
+ << QByteArray("#include \"file1.h\"\n"))
+ << QString::fromLatin1(
+ "Includes\n"
+ " file2.h\n"
+ " file1.h (cyclic)\n"
+ "Included by\n"
+ " file2.h\n"
+ " file1.h (cyclic)\n"
+ );
+
+ QTest::newRow("complex-cyclic")
+ << (QList<QByteArray>()
+ << QByteArray("#include \"file2.h\"\n")
+ << QByteArray("#include \"file3.h\"\n")
+ << QByteArray("#include \"file1.h\"\n"))
+ << QString::fromLatin1(
+ "Includes\n"
+ " file2.h\n"
+ " file3.h\n"
+ " file1.h (cyclic)\n"
+ "Included by\n"
+ " file3.h\n"
+ " file2.h\n"
+ " file1.h (cyclic)\n"
+ );
}
void CppEditorPlugin::test_includehierarchy()