Refuse removing annotations of functions not held; new source files join the build list
- A submission may not drop the annotation of a function of the current build it does not hold (51 annotations were lost that way); removing a duplicate is fine. - A unit missing from compile.json compiles with the command shape of its folder, and the merge adds it to compile.json in the same commit (22 contributor files were outside the build). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b55b592a82
commit
67965b04f1
4 changed files with 102 additions and 3 deletions
18
test/units.test.js
Normal file
18
test/units.test.js
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { inferShape, addUnitsToCompileCommands } from '../src/shared/project.js';
|
||||
|
||||
test('new source files get the flags of their folder and join the build list', () => {
|
||||
const compile = { shapes: [['/a'], ['/b']], units: { 'Engine/Gx/A.cpp': 1, 'Engine/Gx/B.cpp': 1, 'Engine/Base/C.cpp': 0, 'WoW/D.cpp': 0 } };
|
||||
const project = { compile };
|
||||
assert.equal(inferShape(project, 'Engine/Gx/New.cpp'), 1, 'its folder');
|
||||
assert.equal(inferShape(project, 'Engine/Gx/Deep/New.cpp'), 1, 'the nearest folder with units');
|
||||
assert.equal(inferShape(project, 'Tools/X.cpp'), 0, 'the most common one');
|
||||
const text = JSON.stringify(compile, null, 1);
|
||||
const grown = addUnitsToCompileCommands(project, text, ['Engine/Gx/New.cpp', 'Engine/Gx/A.cpp', 'Engine/Gx/x.h', 'WoW/Win32/Old.cpp']);
|
||||
assert.deepEqual(grown.added, ['Engine/Gx/New.cpp'], 'headers, listed units and Win32 copies are left alone');
|
||||
const doc = JSON.parse(grown.text);
|
||||
assert.deepEqual(Object.keys(doc.units), ['Engine/Base/C.cpp', 'Engine/Gx/A.cpp', 'Engine/Gx/B.cpp', 'Engine/Gx/New.cpp', 'WoW/D.cpp']);
|
||||
assert.equal(doc.units['Engine/Gx/New.cpp'], 1);
|
||||
assert.equal(addUnitsToCompileCommands(project, text, ['Engine/Gx/A.cpp']), null);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue