mirror of
https://github.com/affaan-m/ECC.git
synced 2026-11-23 08:15:29 +00:00
Merge reviewed PR #3986 into security and evaluation batch
This commit is contained in:
2 files changed
+17
-1
No files matched your search
@@ -221,7 +221,7 @@ function collectEnforcedAnchors(content) {
|
||||
*/
|
||||
function splitBlocks(content) {
|
||||
const blocks = [];
|
||||
const lines = content.split('\n');
|
||||
const lines = content.split(/\r?\n/);
|
||||
let current = null;
|
||||
for (const line of lines) {
|
||||
let m = line.match(REQUIREMENT_RE);
|
||||
|
||||
@@ -194,6 +194,22 @@ describe('validate-openspec-syntax (v1 schema)', () => {
|
||||
});
|
||||
|
||||
describe('structural validation', () => {
|
||||
for (const [name, eol] of [['LF', '\n'], ['CRLF', '\r\n']]) {
|
||||
it(`reports both missing baseline elements with ${name} line endings`, () => {
|
||||
const content = ['### Requirement: Checkout', '### Invariant: Total', ''].join(eol);
|
||||
const root = makeTempProject({ 'spec.md': content });
|
||||
try {
|
||||
const result = runValidator(root);
|
||||
assert.strictEqual(result.exitCode, 1, result.stdout);
|
||||
const { errors } = JSON.parse(result.stdout);
|
||||
assert.ok(errors.some(error => error.includes('Requirement "Checkout" has no Scenario')));
|
||||
assert.ok(errors.some(error => error.includes('Invariant "Total" missing <!-- enforced: --> anchor')));
|
||||
} finally {
|
||||
fs.rmSync(root, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
it('flags a Requirement with no Scenario', () => {
|
||||
const root = makeTempProject({
|
||||
'noscen/spec.md':
|
||||
|
||||
Reference in new issue
Block a user