Each part is the file's length and breaks its lines where the file does.
(source: string)
| 522 | |
| 523 | /** Each part is the file's length and breaks its lines where the file does. */ |
| 524 | function expectSameShape(source: string): void { |
| 525 | const parts = splitObjcpp(source)!; |
| 526 | expect(parts).not.toBeNull(); |
| 527 | const newlines = (text: string): number[] => [...text].flatMap((ch, k) => (ch === '\n' ? [k] : [])); |
| 528 | for (const part of [parts.cpp, withoutObjcppItems(source, parts.items), parts.sends ?? source]) { |
| 529 | expect(part.length).toBe(source.length); |
| 530 | expect(newlines(part)).toEqual(newlines(source)); |
| 531 | } |
| 532 | } |
| 533 | |
| 534 | it('keeps every offset and every line of the file in each part', () => { |
| 535 | for (const source of [ISSUE, POOLED, MIXED, SYNTAX, CONSTANTS, BESIDE, CONDITIONAL]) expectSameShape(source); |
no test coverage detected