Skip to content

Commit 361bdfa

Browse files
committed
C#: Add a testcase with an empty if statement containing a comment.
1 parent a9d45a2 commit 361bdfa

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

csharp/ql/test/query-tests/Useless Code/FutileConditional/FutileConditional.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,10 @@ public void M(string s)
2525
else
2626
{
2727
} // $ Alert
28+
29+
if (s.Length > 4)
30+
{
31+
// GOOD: Because of the comment.
32+
}
2833
}
2934
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#select
12
| FutileConditional.cs:8:9:8:27 | if (...) ... | If-statement with an empty then-branch and no else-branch. |
23
| FutileConditional.cs:10:9:12:9 | if (...) ... | If-statement with an empty then-branch and no else-branch. |
34
| FutileConditional.cs:22:9:27:9 | if (...) ... | If-statement with an empty then-branch and no else-branch. |
5+
| FutileConditional.cs:29:9:32:9 | if (...) ... | If-statement with an empty then-branch and no else-branch. |
6+
testFailures
7+
| FutileConditional.cs:29:9:32:9 | If-statement with an empty then-branch and no else-branch. | Unexpected result: Alert |

0 commit comments

Comments
 (0)