From 3437e30cac4e46ec4cf62673b508b2616e14b189 Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Tue, 31 Jan 2023 23:32:52 -0800 Subject: [PATCH] Add unit test --- src/dscanner/analysis/unused_result.d | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/dscanner/analysis/unused_result.d b/src/dscanner/analysis/unused_result.d index 85f34a4..3977e15 100644 --- a/src/dscanner/analysis/unused_result.d +++ b/src/dscanner/analysis/unused_result.d @@ -132,6 +132,21 @@ unittest } }c.format(UnusedResultChecker.MSG), sac); + assertAnalyzerWarnings(q{ + struct Foo + { + static bool get() + { + return false; + } + } + alias Bar = Foo; + void main() + { + Bar.get(); // [warn]: %s + } + }c.format(UnusedResultChecker.MSG), sac); + assertAnalyzerWarnings(q{ void main() {