@@ -1106,6 +1106,31 @@ ${M} </pre>
1106
1106
) ;
1107
1107
} ) ;
1108
1108
1109
+ it ( 'unknown oneof' , async ( ) => {
1110
+ await assertError (
1111
+ positioned `
1112
+ <emu-grammar type="definition">
1113
+ Foo :: one of \`a\` \`b\` \`c\`
1114
+ </emu-grammar>
1115
+
1116
+ <emu-clause id="sec-example" type="sdo">
1117
+ <h1>Static Semantics: Example</h1>
1118
+ <dl class='header'></dl>
1119
+ <emu-grammar>
1120
+ Foo :: ${ M } one of \`d\` \`e\`
1121
+ </emu-grammar>
1122
+ <emu-alg>
1123
+ 1. Return *true*.
1124
+ </emu-alg>
1125
+ </emu-clause>` ,
1126
+ {
1127
+ ruleId : 'grammar-shape' ,
1128
+ nodeType : 'emu-grammar' ,
1129
+ message : 'could not find definition for rhs "d e"' ,
1130
+ } ,
1131
+ ) ;
1132
+ } ) ;
1133
+
1109
1134
it ( 'negative' , async ( ) => {
1110
1135
await assertErrorFree ( `
1111
1136
<emu-grammar type="definition">
@@ -1167,5 +1192,49 @@ ${M} </pre>
1167
1192
} ,
1168
1193
) ;
1169
1194
} ) ;
1195
+
1196
+ it ( 'negative: oneof' , async ( ) => {
1197
+ await assertErrorFree ( `
1198
+ <emu-grammar type="definition">
1199
+ Foo :: one of \`a\` \`b\` \`c\`
1200
+ </emu-grammar>
1201
+
1202
+ <emu-clause id="sec-example" type="sdo">
1203
+ <h1>Static Semantics: Example</h1>
1204
+ <dl class='header'></dl>
1205
+ <emu-grammar>
1206
+ Foo :: one of \`a\` \`b\` \`c\`
1207
+ </emu-grammar>
1208
+ <emu-alg>
1209
+ 1. Return *true*.
1210
+ </emu-alg>
1211
+ </emu-clause>
1212
+ ` ) ;
1213
+ } ) ;
1214
+
1215
+ it ( 'negative: oneof (subset)' , async ( ) => {
1216
+ await assertErrorFree ( `
1217
+ <emu-grammar type="definition">
1218
+ Foo :: one of \`a\` \`b\` \`c\` \`d\`
1219
+ </emu-grammar>
1220
+
1221
+ <emu-clause id="sec-example" type="sdo">
1222
+ <h1>Static Semantics: Example</h1>
1223
+ <dl class='header'></dl>
1224
+ <emu-grammar>
1225
+ Foo :: one of \`a\` \`b\`
1226
+ </emu-grammar>
1227
+ <emu-alg>
1228
+ 1. Return *true*.
1229
+ </emu-alg>
1230
+ <emu-grammar>
1231
+ Foo :: one of \`c\` \`d\`
1232
+ </emu-grammar>
1233
+ <emu-alg>
1234
+ 1. Return *false*.
1235
+ </emu-alg>
1236
+ </emu-clause>
1237
+ ` ) ;
1238
+ } ) ;
1170
1239
} ) ;
1171
1240
} ) ;
0 commit comments