@@ -70,7 +70,7 @@ describe('parser tests', (): void => {
70
70
] ) ;
71
71
} ) ;
72
72
it ( 'semantic markup test' , ( ) : void => {
73
- expect ( parse ( 'foo E(a\\),b) P(foo.bar.baz , bam) baz V( b\\,\\na\\)\\\\m\\, ) ' ) ) . toEqual ( [
73
+ expect ( parse ( 'foo E(a\\),b) P(foo.bar.baz , bam) baz V( b\\,\\na\\)\\\\m\\, ) O(foo) ' ) ) . toEqual ( [
74
74
[
75
75
{ type : PartType . TEXT , text : 'foo ' } ,
76
76
{ type : PartType . ENV_VARIABLE , name : 'a),b' } ,
@@ -79,6 +79,188 @@ describe('parser tests', (): void => {
79
79
{ type : PartType . TEXT , text : ' baz ' } ,
80
80
{ type : PartType . OPTION_VALUE , value : ' b,na)\\m, ' } ,
81
81
{ type : PartType . TEXT , text : ' ' } ,
82
+ { type : PartType . OPTION_NAME , plugin : undefined , link : [ 'foo' ] , name : 'foo' , value : undefined } ,
83
+ { type : PartType . TEXT , text : ' ' } ,
84
+ ] ,
85
+ ] ) ;
86
+ } ) ;
87
+ it ( 'semantic markup option name' , ( ) : void => {
88
+ expect ( parse ( 'O(foo)' ) ) . toEqual ( [
89
+ [
90
+ {
91
+ type : PartType . OPTION_NAME ,
92
+ plugin : undefined ,
93
+ link : [ 'foo' ] ,
94
+ name : 'foo' ,
95
+ value : undefined ,
96
+ } ,
97
+ ] ,
98
+ ] ) ;
99
+ expect ( parse ( 'O(ignore:foo)' , { current_plugin : { fqcn : 'foo.bar.baz' , type : 'bam' } } ) ) . toEqual ( [
100
+ [
101
+ {
102
+ type : PartType . OPTION_NAME ,
103
+ plugin : undefined ,
104
+ link : [ 'foo' ] ,
105
+ name : 'foo' ,
106
+ value : undefined ,
107
+ } ,
108
+ ] ,
109
+ ] ) ;
110
+ expect ( parse ( 'O(foo)' , { current_plugin : { fqcn : 'foo.bar.baz' , type : 'bam' } } ) ) . toEqual ( [
111
+ [
112
+ {
113
+ type : PartType . OPTION_NAME ,
114
+ plugin : { fqcn : 'foo.bar.baz' , type : 'bam' } ,
115
+ link : [ 'foo' ] ,
116
+ name : 'foo' ,
117
+ value : undefined ,
118
+ } ,
119
+ ] ,
120
+ ] ) ;
121
+ expect ( parse ( 'O(foo.bar.baz#bam:foo)' ) ) . toEqual ( [
122
+ [
123
+ {
124
+ type : PartType . OPTION_NAME ,
125
+ plugin : { fqcn : 'foo.bar.baz' , type : 'bam' } ,
126
+ link : [ 'foo' ] ,
127
+ name : 'foo' ,
128
+ value : undefined ,
129
+ } ,
130
+ ] ,
131
+ ] ) ;
132
+ expect ( parse ( 'O(foo=bar)' ) ) . toEqual ( [
133
+ [
134
+ {
135
+ type : PartType . OPTION_NAME ,
136
+ plugin : undefined ,
137
+ link : [ 'foo' ] ,
138
+ name : 'foo' ,
139
+ value : 'bar' ,
140
+ } ,
141
+ ] ,
142
+ ] ) ;
143
+ expect ( parse ( 'O(foo.baz=bam)' ) ) . toEqual ( [
144
+ [
145
+ {
146
+ type : PartType . OPTION_NAME ,
147
+ plugin : undefined ,
148
+ link : [ 'foo' , 'baz' ] ,
149
+ name : 'foo.baz' ,
150
+ value : 'bam' ,
151
+ } ,
152
+ ] ,
153
+ ] ) ;
154
+ expect ( parse ( 'O(foo[1].baz[bam.bar.boing].boo)' ) ) . toEqual ( [
155
+ [
156
+ {
157
+ type : PartType . OPTION_NAME ,
158
+ plugin : undefined ,
159
+ link : [ 'foo' , 'baz' , 'boo' ] ,
160
+ name : 'foo[1].baz[bam.bar.boing].boo' ,
161
+ value : undefined ,
162
+ } ,
163
+ ] ,
164
+ ] ) ;
165
+ expect ( parse ( 'O(bar.baz.bam.boo#lookup:foo[1].baz[bam.bar.boing].boo)' ) ) . toEqual ( [
166
+ [
167
+ {
168
+ type : PartType . OPTION_NAME ,
169
+ plugin : { fqcn : 'bar.baz.bam.boo' , type : 'lookup' } ,
170
+ link : [ 'foo' , 'baz' , 'boo' ] ,
171
+ name : 'foo[1].baz[bam.bar.boing].boo' ,
172
+ value : undefined ,
173
+ } ,
174
+ ] ,
175
+ ] ) ;
176
+ } ) ;
177
+ it ( 'semantic markup return value name' , ( ) : void => {
178
+ expect ( parse ( 'RV(foo)' ) ) . toEqual ( [
179
+ [
180
+ {
181
+ type : PartType . RETURN_VALUE ,
182
+ plugin : undefined ,
183
+ link : [ 'foo' ] ,
184
+ name : 'foo' ,
185
+ value : undefined ,
186
+ } ,
187
+ ] ,
188
+ ] ) ;
189
+ expect ( parse ( 'RV(ignore:foo)' , { current_plugin : { fqcn : 'foo.bar.baz' , type : 'bam' } } ) ) . toEqual ( [
190
+ [
191
+ {
192
+ type : PartType . RETURN_VALUE ,
193
+ plugin : undefined ,
194
+ link : [ 'foo' ] ,
195
+ name : 'foo' ,
196
+ value : undefined ,
197
+ } ,
198
+ ] ,
199
+ ] ) ;
200
+ expect ( parse ( 'RV(foo)' , { current_plugin : { fqcn : 'foo.bar.baz' , type : 'bam' } } ) ) . toEqual ( [
201
+ [
202
+ {
203
+ type : PartType . RETURN_VALUE ,
204
+ plugin : { fqcn : 'foo.bar.baz' , type : 'bam' } ,
205
+ link : [ 'foo' ] ,
206
+ name : 'foo' ,
207
+ value : undefined ,
208
+ } ,
209
+ ] ,
210
+ ] ) ;
211
+ expect ( parse ( 'RV(foo.bar.baz#bam:foo)' ) ) . toEqual ( [
212
+ [
213
+ {
214
+ type : PartType . RETURN_VALUE ,
215
+ plugin : { fqcn : 'foo.bar.baz' , type : 'bam' } ,
216
+ link : [ 'foo' ] ,
217
+ name : 'foo' ,
218
+ value : undefined ,
219
+ } ,
220
+ ] ,
221
+ ] ) ;
222
+ expect ( parse ( 'RV(foo=bar)' ) ) . toEqual ( [
223
+ [
224
+ {
225
+ type : PartType . RETURN_VALUE ,
226
+ plugin : undefined ,
227
+ link : [ 'foo' ] ,
228
+ name : 'foo' ,
229
+ value : 'bar' ,
230
+ } ,
231
+ ] ,
232
+ ] ) ;
233
+ expect ( parse ( 'RV(foo.baz=bam)' ) ) . toEqual ( [
234
+ [
235
+ {
236
+ type : PartType . RETURN_VALUE ,
237
+ plugin : undefined ,
238
+ link : [ 'foo' , 'baz' ] ,
239
+ name : 'foo.baz' ,
240
+ value : 'bam' ,
241
+ } ,
242
+ ] ,
243
+ ] ) ;
244
+ expect ( parse ( 'RV(foo[1].baz[bam.bar.boing].boo)' ) ) . toEqual ( [
245
+ [
246
+ {
247
+ type : PartType . RETURN_VALUE ,
248
+ plugin : undefined ,
249
+ link : [ 'foo' , 'baz' , 'boo' ] ,
250
+ name : 'foo[1].baz[bam.bar.boing].boo' ,
251
+ value : undefined ,
252
+ } ,
253
+ ] ,
254
+ ] ) ;
255
+ expect ( parse ( 'RV(bar.baz.bam.boo#lookup:foo[1].baz[bam.bar.boing].boo)' ) ) . toEqual ( [
256
+ [
257
+ {
258
+ type : PartType . RETURN_VALUE ,
259
+ plugin : { fqcn : 'bar.baz.bam.boo' , type : 'lookup' } ,
260
+ link : [ 'foo' , 'baz' , 'boo' ] ,
261
+ name : 'foo[1].baz[bam.bar.boing].boo' ,
262
+ value : undefined ,
263
+ } ,
82
264
] ,
83
265
] ) ;
84
266
} ) ;
0 commit comments