JS: Add test case for wide constants in char class

This commit is contained in:
Asger F
2019-10-24 13:01:11 +01:00
parent 68d23bcf8c
commit 591fffc5cc
3 changed files with 15 additions and 0 deletions

View File

@@ -0,0 +1 @@
| tst.js:1:1:1:9 | /[\\u12340\\udf40-\\u12345\\udf45]/ | Character class with supplementary characters in non-unicode literal. |

View File

@@ -0,0 +1,12 @@
import javascript
from RegExpLiteral literal, RegExpConstant wideConstant
where wideConstant.getLiteral() = literal and
not literal.getFlags().matches("%u%") and
wideConstant.getValue().length() > 1 and
(
wideConstant.getParent() instanceof RegExpCharacterClass
or
wideConstant.getParent() instanceof RegExpCharacterRange
)
select literal, "Character class with supplementary characters in non-unicode literal."

View File

@@ -0,0 +1,2 @@
/[𒍀-𒍅]/; // NOT OK
/[𒍀-𒍅]/u; // OK