File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,8 @@ describe('DisplayFile tests', () => {
22
22
` A 20 DSPATR(PR) ` ,
23
23
` A COLOR(YLW) ` ,
24
24
` A FLD0102 10 B 3 5 ` ,
25
+ ` A R FORM2 ` ,
26
+ ` A 30 SLNO(02) ` ,
25
27
] ;
26
28
27
29
it ( 'getRangeForFormat' , ( ) => {
@@ -95,6 +97,14 @@ describe('DisplayFile tests', () => {
95
97
96
98
} ) ;
97
99
100
+ it ( 'getLinesForFormat' , ( ) => {
101
+ let dds = new DisplayFile ( ) ;
102
+ dds . parse ( dspf1 ) ;
103
+ let lines = DisplayFile . getLinesForFormat ( dds . formats [ 5 ] ) ;
104
+ expect ( lines . length ) . toBe ( 2 ) ;
105
+ expect ( lines [ 1 ] ) . toBe ( ` A 30 SLNO(02)` ) ;
106
+ } ) ;
107
+
98
108
it ( 'No duplicate RecordInfo' , ( ) => {
99
109
let dds = new DisplayFile ( ) ;
100
110
dds . parse ( dspf1 ) ;
Original file line number Diff line number Diff line change @@ -398,7 +398,6 @@ export class DisplayFile {
398
398
return { newLines, range } ;
399
399
}
400
400
401
- // TODO: test cases
402
401
static getLinesForFormat ( recordFormat : RecordInfo ) : string [ ] {
403
402
const lines : string [ ] = [ ] ;
404
403
@@ -407,10 +406,9 @@ export class DisplayFile {
407
406
}
408
407
409
408
for ( const keyword of recordFormat . keywords ) {
410
- // TODO: support conditions
411
- lines . push (
412
- ` A ${ keyword . name } ${ keyword . value ? `(${ keyword . value } )` : `` } ` ,
413
- ) ;
409
+ for ( const keyword of recordFormat . keywords ) {
410
+ lines . push ( ...keyword . conditional . getLinesWithCondition ( ` A ${ keyword . name } ${ keyword . value ? `(${ keyword . value } )` : `` } ` ) ) ;
411
+ }
414
412
}
415
413
416
414
return lines ;
You can’t perform that action at this time.
0 commit comments