Skip to content

Commit

Permalink
Add more unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladiwostok committed Mar 7, 2024
1 parent 2213864 commit 566f4ee
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions src/dscanner/analysis/unused_result.d
Original file line number Diff line number Diff line change
Expand Up @@ -208,5 +208,42 @@ unittest
}
}c, sac, true);

assertAnalyzerWarningsDMD(q{
int fun() { return 1; }
void main()
{
if (true)
fun(); // [warn]: %s
else
fun(); // [warn]: %s
}
}c.format(MSG, MSG), sac, 1);

assertAnalyzerWarningsDMD(q{
int fun() { return 1; }
void main()
{
while (true)
fun(); // [warn]: %s
}
}c.format(MSG), sac, 1);

assertAnalyzerWarningsDMD(q{
int fun() { return 1; }
alias gun = fun;
void main()
{
gun(); // [warn]: %s
}
}c.format(MSG), sac, 1);

assertAnalyzerWarningsDMD(q{
void main()
{
void fun() {}
fun();
}
}c, sac, 1);

stderr.writeln("Unittest for UnusedResultChecker passed");
}

0 comments on commit 566f4ee

Please sign in to comment.