Files
codeql/javascript/ql/test/query-tests/Statements/MisleadingIndentationAfterControlStmt/tst.js
Asger F 10a7294327 JS: Accept trivial test changes
This adds Alert annotations for alerts that seem intentional by the test
but has not been annotated with 'NOT OK', or the comment was in the wrong
place.

In a few cases I included 'Source' expectations to make it easier to see
what happened. Other 'Source' expectations will be added in bulk a later
commit.
2025-02-28 13:27:43 +01:00

123 lines
1.1 KiB
JavaScript

function bad1() {
if (cond())
f();
g(); // $ Alert
}
function good1() {
if (cond()) {
f();
}
g();
}
function good2() {
if (cond())
f();
g();
}
function bad2() {
if (cond())
f();
else
g();
h(); // $ Alert
}
function good3() {
if (cond())
f();
g();
}
function wbad1() {
while (cond())
f();
g(); // $ Alert
}
function wgood1() {
while (cond()) {
f();
}
g();
}
function wgood2() {
while (cond())
f();
g();
}
function wgood3() {
while (cond())
f();
g();
}
function dgood() {
do
f();
while (false);
g();
}
function tgood() {
try {
if (cond())
throw new Error();
} finally {}
f();
}
function good4() {
if (cond())
f();
g();
}
function good5() {
try {
} catch (e) {
}
}
function good6() {
try {
} catch (e) {
};
}
function good7() {
if (e) {
try {
} catch (e) {
}
}
}
function good8() {
if (e) {
try {
} catch (e) {
};
}
}
function good9() {
if(e){
try{
} catch(e){
};
}
}
function good10() {
if(e){
try{
}catch(e){
};
}
}