File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ test('constants are not correctly loaded', () => {
7979} )
8080
8181test ( 'operator syntax type error' , ( ) => {
82- const code = 'const num = 3; \nnum++; \nnum--; \nnum += 1;'
82+ const code = 'const num = 3; \nnum++; \nnum--; \nnum += 1; \n5 + num |2; '
8383
8484 setSession ( Chapter . SOURCE_1 , defaultVariant , defaultExternal , code )
8585
@@ -91,6 +91,15 @@ test('operator syntax type error', () => {
9191
9292 const token3 = session . getTokenAt ( 3 , 5 )
9393 expect ( expectedBool ( token3 , CATEGORY . forbidden ) ) . toBe ( true )
94+
95+ const token4 = session . getTokenAt ( 4 , 1 )
96+ expect ( expectedBool ( token4 , CATEGORY . number ) ) . toBe ( true )
97+
98+ const token5 = session . getTokenAt ( 4 , 9 )
99+ expect ( expectedBool ( token5 , CATEGORY . forbidden ) ) . toBe ( true )
100+
101+ const token6 = session . getTokenAt ( 4 , 10 )
102+ expect ( expectedBool ( token6 , CATEGORY . number ) ) . toBe ( true )
94103} )
95104
96105test ( 'forbidden keywords' , ( ) => {
Original file line number Diff line number Diff line change @@ -113,9 +113,9 @@ export function HighlightRulesSelector(
113113 const VariantForbiddenRegexSelector = ( ) => {
114114 if ( variant === Variant . TYPED ) {
115115 // Removes the part of the regex that highlights singular |, since Typed variant uses union types
116- return / \. { 3 } | - - + | \+ \+ + | \^ | ( = = | ! = ) [ ^ = ] | [ $ % & * + \- ~ \/ ^ ] = + | [ ^ & ] * & [ ^ & ] /
116+ return / \. { 3 } | - - + | \+ \+ + | \^ | ( = = | ! = ) [ ^ = ] | [ $ % & * + \- ~ \/ ^ ] = + | (?< ! & ) & (? ! & ) /
117117 }
118- return / \. { 3 } | - - + | \+ \+ + | \^ | ( = = | ! = ) [ ^ = ] | [ $ % & * + \- ~ \/ ^ ] = + | [ ^ & ] * & [ ^ & ] | [ ^ \| ] * \| [ ^ \| ] /
118+ return / \. { 3 } | - - + | \+ \+ + | \^ | ( = = | ! = ) [ ^ = ] | [ $ % & * + \- ~ \/ ^ ] = + | (?< ! & ) & (? ! & ) | (?< ! \| ) \| (? ! \| ) /
119119 }
120120
121121 // @ts -ignore
You can’t perform that action at this time.
0 commit comments