fuzzy - add test coverage for path matching (#236435)

pull/236446/head
Benjamin Pasero 2024-12-18 07:43:11 +01:00 committed by GitHub
parent 20899216df
commit 95d0e288d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 15 additions and 0 deletions

View File

@ -1081,6 +1081,21 @@ suite('Fuzzy Scorer', () => {
}
});
test('compareFilesByScore - skip preference on label match when using path sep', function () {
const resourceA = URI.file('djangosite/ufrela/def.py');
const resourceB = URI.file('djangosite/urls/default.py');
for (const query of ['url/def']) {
let res = [resourceA, resourceB].sort((r1, r2) => compareItemsByScore(r1, r2, query, true, ResourceAccessor));
assert.strictEqual(res[0], resourceB);
assert.strictEqual(res[1], resourceA);
res = [resourceB, resourceA].sort((r1, r2) => compareItemsByScore(r1, r2, query, true, ResourceAccessor));
assert.strictEqual(res[0], resourceB);
assert.strictEqual(res[1], resourceA);
}
});
test('compareFilesByScore - boost shorter prefix match if multiple queries are used (#99171)', function () {
const resourceA = URI.file('mesh_editor_lifetime_job.h');
const resourceB = URI.file('lifetime_job.h');