MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / expectBlanked

Function expectBlanked

__tests__/cpp-attribute-macros.test.ts:38–48  ·  view source on GitHub ↗

Assert `blank` removes exactly `macros` from `input` and nothing else, offsets kept.

(blank: (s: string) => string, input: string, macros: string[])

Source from the content-addressed store, hash-verified

36
37/** Assert `blank` removes exactly `macros` from `input` and nothing else, offsets kept. */
38function expectBlanked(blank: (s: string) => string, input: string, macros: string[]): void {
39 const out = blank(input);
40 expect(out.length).toBe(input.length);
41 let expected = input;
42 for (const macro of macros) {
43 const at = expected.indexOf(macro);
44 expect(at, `${macro} in ${input}`).toBeGreaterThanOrEqual(0);
45 expected = expected.slice(0, at) + macro.replace(/[^\r\n]/g, ' ') + expected.slice(at + macro.length);
46 }
47 expect(out).toBe(expected);
48}
49
50describe('C++ attribute-macro blanks', () => {
51 it('blanks every macro between class and the name, and before a specialization', () => {

Callers 1

Calls 1

blankFunction · 0.70

Tested by

no test coverage detected