Skip to content

Commit

Permalink
Fix indexer test
Browse files Browse the repository at this point in the history
The recent change that implemented documentation for classes
has broken the test. The test (and test data) also had to be
updated to reflect the new checks whether a file should be
indexed or not.
  • Loading branch information
danvratil committed May 24, 2024
1 parent 3e2604d commit a8dce86
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ node_modules
.vscode-test/
*.vsix
Testing
src/test/data_src/output/
Binary file modified src/test/data/test.qch
Binary file not shown.
2 changes: 1 addition & 1 deletion src/test/data_src/src/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/*!
\class TestClass
\since 1.0
\inmodule Test
\inmodule Qt Test
\brief This class is used for testing QCH parser.
Expand Down
26 changes: 13 additions & 13 deletions src/test/data_src/test.qdocconf
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#
# SPDX-License-Identifier: MIT

project = Test
description = Test Documentation
project = Qt Test
description = Qt Test Documentation
version = 1.0
moduleheader = TestDoc

Expand All @@ -12,16 +12,16 @@ sourcedirs = src

outputdir = output

qhp.projects = Test
qhp.projects = QtTest

qhp.Test.file = test.qhp
qhp.Test.namespace = org.cz.dvratil.Test.1
qhp.Test.virtualFolder = testfolder
qhp.Test.indexTitle = Test Documentation
qhp.Test.indexRoot =
qhp.QtTest.file = test.qhp
qhp.QtTest.namespace = org.cz.dvratil.Test.1
qhp.QtTest.virtualFolder = testfolder
qhp.QtTest.indexTitle = Qt Test Documentation
qhp.QtTest.indexRoot =

qhp.Test.subprojects = classes
qhp.Test.subprojects.classes.title = C++ Classes
qhp.Test.subprojects.classes.indexTitle = Test C++ Classes
qhp.Test.subprojects.classes.selectors = class fake:headerfile
qhp.Test.subprojects.classes.sortPages = true
qhp.QtTest.subprojects = classes
qhp.QtTest.subprojects.classes.title = C++ Classes
qhp.QtTest.subprojects.classes.indexTitle = Qt Test C++ Classes
qhp.QtTest.subprojects.classes.selectors = class fake:headerfile
qhp.QtTest.subprojects.classes.sortPages = true
8 changes: 7 additions & 1 deletion src/test/indexer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@ suite("Indexer", async () => {

await assert.doesNotReject(indexQCHFile(sqlite, path.join(__dirname, "../../src/test/data/test.qch"), symbolMap, fileMap));

assert.strictEqual(symbolMap.size, 4);
assert.strictEqual(symbolMap.size, 5);
assert.strictEqual(fileMap.size, 1);

const testClassKey = string_hash("TestClass");
assert.ok(symbolMap.has(testClassKey));
const testClass = symbolMap.get(testClassKey)!;
assert.ok(testClass.anchor.offset > 0);
assert.ok(testClass.anchor.len > 0);

const setTestPropertyKey = string_hash("TestClass::setTestProperty");
assert.ok(symbolMap.has(setTestPropertyKey));
const setTestProperty = symbolMap.get(setTestPropertyKey)!;
Expand Down

0 comments on commit a8dce86

Please sign in to comment.