@@ -92,14 +92,14 @@ test("ds_extname", async () => {
92
92
expect ( structDef . subItems . length ) . toBe ( 14 ) ;
93
93
} ) ;
94
94
95
- test ( "ds_extname_no_alias " , async ( ) => {
95
+ test ( "ds_extname " , async ( ) => {
96
96
const lines = [
97
97
`**free` ,
98
98
`` ,
99
- `Dcl-Ds dept ExtName('department ') Qualified;` ,
99
+ `Dcl-Ds Employee ExtName('EMPLOYEE ') Qualified;` ,
100
100
`end-ds;` ,
101
101
`` ,
102
- `Dsply dept.deptname ;` ,
102
+ `Dsply Employee.empno ;` ,
103
103
`` ,
104
104
`return;`
105
105
] . join ( `\n` ) ;
@@ -109,11 +109,31 @@ test("ds_extname_no_alias", async () => {
109
109
expect ( cache . files . length ) . toBe ( 0 ) ;
110
110
expect ( cache . structs . length ) . toBe ( 1 ) ;
111
111
112
- const dept = cache . find ( `dept` ) ;
113
- expect ( dept . subItems . length ) . toBe ( 5 ) ;
112
+ const structDef = cache . find ( `employee` ) ;
113
+ expect ( structDef . name ) . toBe ( `Employee` ) ;
114
+ expect ( structDef . subItems . length ) . toBe ( 14 ) ;
115
+ } ) ;
114
116
115
- expect ( dept . subItems [ 0 ] . name ) . toBe ( `DEPTNO` ) ;
116
- expect ( dept . subItems [ 1 ] . name ) . toBe ( `DEPTNAME` ) ;
117
+ test ( "ds_extname_template" , async ( ) => {
118
+ const lines = [
119
+ `**free` ,
120
+ `` ,
121
+ `Dcl-Ds dept ExtName('department') Qualified template end-ds;` ,
122
+ `` ,
123
+ `Dcl-DS dsExample qualified inz;` ,
124
+ ` Field1 like(tmpDS.Field1) inz;` ,
125
+ ` Field2 like(tmpDS.Field2) inz;` ,
126
+ `END-DS` ,
127
+ `` ,
128
+ `return;`
129
+ ] . join ( `\n` ) ;
130
+
131
+ const cache = await parser . getDocs ( uri , lines , { withIncludes : true , ignoreCache : true } ) ;
132
+
133
+ expect ( cache . structs . length ) . toBe ( 2 ) ;
134
+
135
+ const dept = cache . find ( `dsExample` ) ;
136
+ expect ( dept . subItems . length ) . toBe ( 2 ) ;
117
137
} ) ;
118
138
119
139
test ( "ds_extname_alias" , async ( ) => {
@@ -187,4 +207,5 @@ test('file DS in a copy book', async () => {
187
207
expect ( someStruct . subItems . length ) . toBeGreaterThan ( 0 ) ;
188
208
189
209
expect ( someStruct . subItems . map ( s => ( { name : s . name , keyword : s . keyword } ) ) ) . toMatchObject ( globalStruct . subItems . map ( s => ( { name : s . name , keyword : s . keyword } ) ) ) ;
190
- } )
210
+ } ) ;
211
+
0 commit comments