Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/tests/dspf.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ describe('DisplayFile tests', () => {
` A 1 3'Opt' `,
` A COLOR(BLU) `,
` A 1 8'Name' `,
` A COLOR(BLU) `
` A COLOR(BLU) `,
` A R GLOBAL `,
` A SLNO(04) `,
` A 1 3'---' `,
];

it('getRangeForFormat', () => {
Expand All @@ -26,12 +29,17 @@ describe('DisplayFile tests', () => {
range = dds.getRangeForFormat(`FMT1`);
expect(range?.start).toBe(3);
expect(range?.end).toBe(9);
expect(true).toBe(true);

range = dds.getRangeForFormat(`HEAD`);
expect(range?.start).toBe(1);
expect(range?.end).toBe(3);
expect(true).toBe(true);
});

it('No duplicate RecordInfo', () => {
let dds = new DisplayFile();
dds.parse(dspf1);
let names = dds.formats.map(rcd => rcd.name);
expect(new Set(names).size).toBe(names.length);
});

});
2 changes: 1 addition & 1 deletion src/ui/dspf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
export interface DdsLineRange { start: number, endHeader?: number, end: number };
export interface DdsUpdate { newLines: string[], range?: DdsLineRange };

const GLOBAL_RECORD_NAME = `GLOBAL`;
const GLOBAL_RECORD_NAME = `_GLOBAL`;

export class DisplayFile {
public formats: RecordInfo[] = [];
Expand Down