@@ -131,7 +131,12 @@ describe('parser', (): void => {
131131 { type : PartType . TEXT , text : 'foo ' , source : undefined } ,
132132 { type : PartType . ENV_VARIABLE , name : 'a),b' , source : undefined } ,
133133 { type : PartType . TEXT , text : ' ' , source : undefined } ,
134- { type : PartType . PLUGIN , plugin : { fqcn : 'foo.bar.baz' , type : 'bam' } , source : undefined } ,
134+ {
135+ type : PartType . PLUGIN ,
136+ plugin : { fqcn : 'foo.bar.baz' , type : 'bam' } ,
137+ entrypoint : undefined ,
138+ source : undefined ,
139+ } ,
135140 { type : PartType . TEXT , text : ' baz ' , source : undefined } ,
136141 { type : PartType . OPTION_VALUE , value : ' b,na)\\m, ' , source : undefined } ,
137142 { type : PartType . TEXT , text : ' ' , source : undefined } ,
@@ -147,6 +152,23 @@ describe('parser', (): void => {
147152 { type : PartType . TEXT , text : ' ' , source : undefined } ,
148153 ] ,
149154 ] ) ;
155+ expect ( parse ( 'P(foo.bar.baz#role) P(foo.bar.baz#role:entrypoint)' ) ) . toEqual ( [
156+ [
157+ {
158+ type : PartType . PLUGIN ,
159+ plugin : { fqcn : 'foo.bar.baz' , type : 'role' } ,
160+ entrypoint : undefined ,
161+ source : undefined ,
162+ } ,
163+ { type : PartType . TEXT , text : ' ' , source : undefined } ,
164+ {
165+ type : PartType . PLUGIN ,
166+ plugin : { fqcn : 'foo.bar.baz' , type : 'role' } ,
167+ entrypoint : 'entrypoint' ,
168+ source : undefined ,
169+ } ,
170+ ] ,
171+ ] ) ;
150172 } ) ;
151173 it ( 'semantic markup test (with source)' , ( ) : void => {
152174 expect ( parse ( 'foo E(a\\),b) P(foo.bar.baz#bam) baz V( b\\,\\na\\)\\\\m\\, ) O(foo) ' , { addSource : true } ) ) . toEqual (
@@ -155,7 +177,12 @@ describe('parser', (): void => {
155177 { type : PartType . TEXT , text : 'foo ' , source : 'foo ' } ,
156178 { type : PartType . ENV_VARIABLE , name : 'a),b' , source : 'E(a\\),b)' } ,
157179 { type : PartType . TEXT , text : ' ' , source : ' ' } ,
158- { type : PartType . PLUGIN , plugin : { fqcn : 'foo.bar.baz' , type : 'bam' } , source : 'P(foo.bar.baz#bam)' } ,
180+ {
181+ type : PartType . PLUGIN ,
182+ plugin : { fqcn : 'foo.bar.baz' , type : 'bam' } ,
183+ entrypoint : undefined ,
184+ source : 'P(foo.bar.baz#bam)' ,
185+ } ,
159186 { type : PartType . TEXT , text : ' baz ' , source : ' baz ' } ,
160187 { type : PartType . OPTION_VALUE , value : ' b,na)\\m, ' , source : 'V( b\\,\\na\\)\\\\m\\, )' } ,
161188 { type : PartType . TEXT , text : ' ' , source : ' ' } ,
@@ -172,6 +199,23 @@ describe('parser', (): void => {
172199 ] ,
173200 ] ,
174201 ) ;
202+ expect ( parse ( 'P(foo.bar.baz#role) P(foo.bar.baz#role:entrypoint)' ) ) . toEqual ( [
203+ [
204+ {
205+ type : PartType . PLUGIN ,
206+ plugin : { fqcn : 'foo.bar.baz' , type : 'role' } ,
207+ entrypoint : undefined ,
208+ source : undefined ,
209+ } ,
210+ { type : PartType . TEXT , text : ' ' , source : undefined } ,
211+ {
212+ type : PartType . PLUGIN ,
213+ plugin : { fqcn : 'foo.bar.baz' , type : 'role' } ,
214+ entrypoint : 'entrypoint' ,
215+ source : undefined ,
216+ } ,
217+ ] ,
218+ ] ) ;
175219 } ) ;
176220 it ( 'semantic markup option name' , ( ) : void => {
177221 expect ( parse ( 'O(foo)' ) ) . toEqual ( [
@@ -432,6 +476,12 @@ describe('parser', (): void => {
432476 expect ( async ( ) => parse ( 'P(foo.bar.baz#b m)' , { errors : 'exception' , helpfulErrors : false } ) ) . rejects . toThrow (
433477 'While parsing P() at index 1: Plugin type "b m" is not valid' ,
434478 ) ;
479+ expect ( async ( ) =>
480+ parse ( 'P(foo.bar.baz#module:e p)' , { errors : 'exception' , helpfulErrors : false } ) ,
481+ ) . rejects . toThrow ( 'While parsing P() at index 1: Entrypoint "e p" is not valid' ) ;
482+ expect ( async ( ) =>
483+ parse ( 'P(foo.bar.baz#module:entrypoint)' , { errors : 'exception' , helpfulErrors : false } ) ,
484+ ) . rejects . toThrow ( 'While parsing P() at index 1: Only role references can have entrypoints' ) ;
435485 } ) ;
436486 it ( 'bad option name/return value (throw error)' , ( ) : void => {
437487 expect ( async ( ) =>
@@ -446,6 +496,9 @@ describe('parser', (): void => {
446496 expect ( async ( ) => parse ( 'O(foo.bar.baz#role:bam)' , { errors : 'exception' , helpfulErrors : false } ) ) . rejects . toThrow (
447497 'While parsing O() at index 1: Role reference is missing entrypoint' ,
448498 ) ;
499+ expect ( async ( ) =>
500+ parse ( 'O(foo.bar.baz#role:e p:bam)' , { errors : 'exception' , helpfulErrors : false } ) ,
501+ ) . rejects . toThrow ( 'While parsing O() at index 1: Entrypoint "e p" is not valid' ) ;
449502 } ) ;
450503 it ( 'bad parameter parsing (no escaping, error message)' , ( ) : void => {
451504 expect ( parse ( 'M(' , { helpfulErrors : false } ) ) . toEqual ( [
0 commit comments