Changeset View
Changeset View
Standalone View
Standalone View
unittests/clangd/IndexTests.cpp
Show First 20 Lines • Show All 219 Lines • ▼ Show 20 Lines | |||||
} | } | ||||
TEST(MergeTest, Merge) { | TEST(MergeTest, Merge) { | ||||
Symbol L, R; | Symbol L, R; | ||||
L.ID = R.ID = SymbolID("hello"); | L.ID = R.ID = SymbolID("hello"); | ||||
L.Name = R.Name = "Foo"; // same in both | L.Name = R.Name = "Foo"; // same in both | ||||
L.CanonicalDeclaration.FileURI = "file:///left.h"; // differs | L.CanonicalDeclaration.FileURI = "file:///left.h"; // differs | ||||
R.CanonicalDeclaration.FileURI = "file:///right.h"; | R.CanonicalDeclaration.FileURI = "file:///right.h"; | ||||
L.References = 1; | |||||
R.References = 2; | |||||
L.CompletionPlainInsertText = "f00"; // present in left only | L.CompletionPlainInsertText = "f00"; // present in left only | ||||
R.CompletionSnippetInsertText = "f0{$1:0}"; // present in right only | R.CompletionSnippetInsertText = "f0{$1:0}"; // present in right only | ||||
Symbol::Details DetL, DetR; | Symbol::Details DetL, DetR; | ||||
DetL.CompletionDetail = "DetL"; | DetL.CompletionDetail = "DetL"; | ||||
DetR.CompletionDetail = "DetR"; | DetR.CompletionDetail = "DetR"; | ||||
DetR.Documentation = "--doc--"; | DetR.Documentation = "--doc--"; | ||||
L.Detail = &DetL; | L.Detail = &DetL; | ||||
R.Detail = &DetR; | R.Detail = &DetR; | ||||
Symbol::Details Scratch; | Symbol::Details Scratch; | ||||
Symbol M = mergeSymbol(L, R, &Scratch); | Symbol M = mergeSymbol(L, R, &Scratch); | ||||
EXPECT_EQ(M.Name, "Foo"); | EXPECT_EQ(M.Name, "Foo"); | ||||
EXPECT_EQ(M.CanonicalDeclaration.FileURI, "file:///left.h"); | EXPECT_EQ(M.CanonicalDeclaration.FileURI, "file:///left.h"); | ||||
EXPECT_EQ(M.References, 3u); | |||||
EXPECT_EQ(M.CompletionPlainInsertText, "f00"); | EXPECT_EQ(M.CompletionPlainInsertText, "f00"); | ||||
EXPECT_EQ(M.CompletionSnippetInsertText, "f0{$1:0}"); | EXPECT_EQ(M.CompletionSnippetInsertText, "f0{$1:0}"); | ||||
ASSERT_TRUE(M.Detail); | ASSERT_TRUE(M.Detail); | ||||
EXPECT_EQ(M.Detail->CompletionDetail, "DetL"); | EXPECT_EQ(M.Detail->CompletionDetail, "DetL"); | ||||
EXPECT_EQ(M.Detail->Documentation, "--doc--"); | EXPECT_EQ(M.Detail->Documentation, "--doc--"); | ||||
} | } | ||||
TEST(MergeTest, PreferSymbolWithDefn) { | TEST(MergeTest, PreferSymbolWithDefn) { | ||||
Show All 24 Lines |