diff options
author | Marco Bubke <marco.bubke@theqtcompany.com> | 2015-08-31 16:10:36 +0200 |
---|---|---|
committer | Marco Bubke <marco.bubke@theqtcompany.com> | 2015-08-31 15:02:19 +0000 |
commit | 7eee8061f65f10babed7476e45de21088dcd6285 (patch) | |
tree | c828e314c2754263eb20e78b2fc007d40836663e /tests/unit/unittest/readandwritemessageblocktest.cpp | |
parent | 3114780e5526934bd6d61994d9341544bf10499a (diff) | |
download | qt-creator-7eee8061f65f10babed7476e45de21088dcd6285.tar.gz |
Clang: Add unsaved files messages
We have auto generated buffers from ui files which are not open but have no
file representation. So we need to provide them as unsaved files only.
Change-Id: I48a426c18e06eeda2fa707864f32f293e17ac651
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
Diffstat (limited to 'tests/unit/unittest/readandwritemessageblocktest.cpp')
-rw-r--r-- | tests/unit/unittest/readandwritemessageblocktest.cpp | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/tests/unit/unittest/readandwritemessageblocktest.cpp b/tests/unit/unittest/readandwritemessageblocktest.cpp index 671d84d949..161a2529ba 100644 --- a/tests/unit/unittest/readandwritemessageblocktest.cpp +++ b/tests/unit/unittest/readandwritemessageblocktest.cpp @@ -40,6 +40,8 @@ #include <requestdiagnosticsmessage.h> #include <readmessageblock.h> #include <sourcelocation.h> +#include <registerunsavedfilesforeditormessage.h> +#include <unregisterunsavedfilesforeditormessage.h> #include <writemessageblock.h> #include <QBuffer> @@ -73,6 +75,11 @@ protected: void readPartialMessage(); protected: + ClangBackEnd::FileContainer fileContainer{Utf8StringLiteral("foo.cpp"), + Utf8StringLiteral("projectPartId"), + Utf8StringLiteral("unsaved content"), + true, + 1}; QBuffer buffer; ClangBackEnd::WriteMessageBlock writeMessageBlock; ClangBackEnd::ReadMessageBlock readMessageBlock; @@ -141,16 +148,11 @@ TEST_F(ReadAndWriteMessageBlock, CompareAliveMessage) TEST_F(ReadAndWriteMessageBlock, CompareRegisterTranslationUnitForEditorMessage) { - ClangBackEnd::FileContainer fileContainer(Utf8StringLiteral("foo.cpp"), Utf8StringLiteral("pathToProject.pro")); - QVector<ClangBackEnd::FileContainer> fileContainers({fileContainer}); - - CompareMessage(ClangBackEnd::RegisterTranslationUnitForEditorMessage(fileContainers)); + CompareMessage(ClangBackEnd::RegisterTranslationUnitForEditorMessage({fileContainer})); } TEST_F(ReadAndWriteMessageBlock, CompareUnregisterFileForEditorMessage) { - ClangBackEnd::FileContainer fileContainer(Utf8StringLiteral("foo.cpp"), Utf8StringLiteral("pathToProject.pro")); - CompareMessage(ClangBackEnd::UnregisterTranslationUnitsForEditorMessage({fileContainer})); } @@ -168,8 +170,6 @@ TEST_F(ReadAndWriteMessageBlock, CompareCodeCompletedMessage) TEST_F(ReadAndWriteMessageBlock, CompareDiagnosticsChangedMessage) { - ClangBackEnd::FileContainer fileContainer(Utf8StringLiteral("foo.cpp"), - Utf8StringLiteral("projectId")); ClangBackEnd::DiagnosticContainer container(Utf8StringLiteral("don't do that"), Utf8StringLiteral("warning"), {Utf8StringLiteral("-Wpadded"), Utf8StringLiteral("-Wno-padded")}, @@ -183,10 +183,18 @@ TEST_F(ReadAndWriteMessageBlock, CompareDiagnosticsChangedMessage) {container})); } -TEST_F(ReadAndWriteMessageBlock, RequestDiagnosticsMessage) +TEST_F(ReadAndWriteMessageBlock, CompareRegisterUnsavedFilesForEditorMessage) { - ClangBackEnd::FileContainer fileContainer(Utf8StringLiteral("foo.cpp"), Utf8StringLiteral("pathToProject.pro")); + CompareMessage(ClangBackEnd::RegisterUnsavedFilesForEditorMessage({fileContainer})); +} +TEST_F(ReadAndWriteMessageBlock, CompareUnregisterUnsavedFilesForEditorMessage) +{ + CompareMessage(ClangBackEnd::UnregisterUnsavedFilesForEditorMessage({fileContainer})); +} + +TEST_F(ReadAndWriteMessageBlock, CompareRequestDiagnosticsMessage) +{ CompareMessage(ClangBackEnd::RequestDiagnosticsMessage(fileContainer)); } |