File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change 1+ import { expect , describe , it } from "vitest" ;
2+ import { DdsLineRange , DisplayFile } from "../ui/dspf" ;
3+
4+ describe ( 'DisplayFile tests' , ( ) => {
5+
6+ const dspf1 : string [ ] = [
7+ ` A DSPSIZ(24 80 *DS3) ` ,
8+ ` A R HEAD ` ,
9+ ` A 1 32'vscode-displayfile' ` ,
10+ ` A R FMT1 ` ,
11+ ` A SLNO(03) ` ,
12+ ` A 1 3'Opt' ` ,
13+ ` A COLOR(BLU) ` ,
14+ ` A 1 8'Name' ` ,
15+ ` A COLOR(BLU) `
16+ ] ;
17+
18+ it ( 'getRangeForFormat' , ( ) => {
19+ let dds = new DisplayFile ( ) ;
20+ dds . parse ( dspf1 ) ;
21+
22+ expect ( dds . getRangeForFormat ( `DONOTEXIST` ) ) . toBeUndefined ( ) ;
23+
24+ let range : DdsLineRange | undefined ;
25+
26+ range = dds . getRangeForFormat ( `FMT1` ) ;
27+ expect ( range ?. start ) . toBe ( 3 ) ;
28+ expect ( range ?. end ) . toBe ( 9 ) ;
29+ expect ( true ) . toBe ( true ) ;
30+
31+ range = dds . getRangeForFormat ( `HEAD` ) ;
32+ expect ( range ?. start ) . toBe ( 1 ) ;
33+ expect ( range ?. end ) . toBe ( 3 ) ;
34+ expect ( true ) . toBe ( true ) ;
35+ } ) ;
36+
37+ } ) ;
Original file line number Diff line number Diff line change @@ -456,7 +456,6 @@ export class DisplayFile {
456456 return lines ;
457457 }
458458
459- // TODO: test cases
460459 public getRangeForFormat ( recordFormat : string ) : DdsLineRange | undefined {
461460 let range : DdsLineRange | undefined = undefined ;
462461 const currentFormatI = this . formats . findIndex ( format => format . name === recordFormat ) ;
You can’t perform that action at this time.
0 commit comments