summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibJS/Tests/string-escapes.js
diff options
context:
space:
mode:
authordavidot <davidot@serenityos.org>2021-11-26 23:26:42 +0100
committerLinus Groh <mail@linusgroh.de>2021-11-30 17:05:32 +0000
commit7624c3de0e2cb4bce171a3524cdbc070257ef93c (patch)
tree7ebee28cb87769e0845631fec44a18752a20d4a6 /Userland/Libraries/LibJS/Tests/string-escapes.js
parentc57721cf836aa76f21fb6d18ad47ddda0429c8fa (diff)
downloadserenity-7624c3de0e2cb4bce171a3524cdbc070257ef93c.zip
LibJS: Disallow '\8' and '\9' in strict mode due to being octal escapes
Diffstat (limited to 'Userland/Libraries/LibJS/Tests/string-escapes.js')
-rw-r--r--Userland/Libraries/LibJS/Tests/string-escapes.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Tests/string-escapes.js b/Userland/Libraries/LibJS/Tests/string-escapes.js
index 64a81b1fe1..9b45d08588 100644
--- a/Userland/Libraries/LibJS/Tests/string-escapes.js
+++ b/Userland/Libraries/LibJS/Tests/string-escapes.js
@@ -62,4 +62,11 @@ describe("octal escapes", () => {
// Because of the non string statement in the middle strict mode is not enabled.
expect("'\\123'; somethingElse; 'use strict'").toEval();
});
+
+ test("invalid octal escapes fail in strict mode", () => {
+ expect("'use strict'; '\\8'").not.toEval();
+ expect("'use strict'; '\\800'").not.toEval();
+ expect("'use strict'; '\\9'").not.toEval();
+ expect("'use strict'; '\\912'").not.toEval();
+ });
});