mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 12:05:15 +00:00
LibJS: Add test for semicolon insertion (#1828)
This commit is contained in:
parent
19cdda8000
commit
63e1ea7819
Notes:
sideshowbarker
2024-07-19 07:32:00 +09:00
Author: https://github.com/sunverwerth Commit: https://github.com/SerenityOS/serenity/commit/63e1ea78198 Pull-request: https://github.com/SerenityOS/serenity/pull/1828
1 changed files with 32 additions and 0 deletions
32
Libraries/LibJS/Tests/automatic-semicolon-insertion.js
Normal file
32
Libraries/LibJS/Tests/automatic-semicolon-insertion.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
load("test-common.js");
|
||||
|
||||
/**
|
||||
* This file tests automatic semicolon insertion rules.
|
||||
* If this file produces syntax errors, something is wrong.
|
||||
*/
|
||||
|
||||
function foo() {
|
||||
for (var i = 0; i < 4; i++) {
|
||||
break // semicolon inserted here
|
||||
continue // semicolon inserted here
|
||||
}
|
||||
|
||||
var j // semicolon inserted here
|
||||
|
||||
do {
|
||||
} while (1 === 2) // semicolon inserted here
|
||||
|
||||
return // semicolon inserted here
|
||||
1;
|
||||
var curly/* semicolon inserted here */}
|
||||
|
||||
try {
|
||||
assert(foo() === undefined);
|
||||
|
||||
console.log("PASS");
|
||||
} catch (e) {
|
||||
console.log("FAIL: " + e);
|
||||
}
|
||||
|
||||
// This vardecl must appear exactly at the end of the file (no newline or whitespace after it)
|
||||
var eof
|
Loading…
Add table
Reference in a new issue