Respect "skip unittest" user configuration (#139)
This commit is contained in:
parent
f8cc9cd8fc
commit
355ce407d2
|
|
@ -24,6 +24,9 @@ extern(C++) class ExplicitlyAnnotatedUnittestCheck(AST) : BaseAnalyzerDmd
|
|||
{
|
||||
import dmd.astenums : STC;
|
||||
|
||||
if (skipTests)
|
||||
return;
|
||||
|
||||
if (!(d.storage_class & STC.safe || d.storage_class & STC.system))
|
||||
addErrorMessage(cast(ulong) d.loc.linnum, cast(ulong) d.loc.charnum,
|
||||
KEY, MESSAGE);
|
||||
|
|
|
|||
|
|
@ -47,6 +47,9 @@ extern (C++) class HasPublicExampleCheck(AST) : BaseAnalyzerDmd
|
|||
|
||||
override void visit(AST.UnitTestDeclaration unitTestDecl)
|
||||
{
|
||||
if (skipTests)
|
||||
return;
|
||||
|
||||
if (unitTestDecl.comment() !is null)
|
||||
isDocumented = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ extern (C++) class LabelVarNameCheck(AST) : BaseAnalyzerDmd
|
|||
|
||||
mixin FunctionVisit!(AST.FuncDeclaration);
|
||||
mixin FunctionVisit!(AST.TemplateDeclaration);
|
||||
mixin FunctionVisit!(AST.UnitTestDeclaration);
|
||||
mixin FunctionVisit!(AST.FuncLiteralDeclaration);
|
||||
|
||||
mixin AggregateVisit!(AST.ClassDeclaration);
|
||||
|
|
@ -134,6 +133,28 @@ extern (C++) class LabelVarNameCheck(AST) : BaseAnalyzerDmd
|
|||
popAggregateName();
|
||||
}
|
||||
|
||||
override void visit(AST.UnitTestDeclaration unitTestDecl)
|
||||
{
|
||||
if (skipTests)
|
||||
return;
|
||||
|
||||
auto oldIsInFunction = isInFunction;
|
||||
auto oldIsInLocalFunction = isInLocalFunction;
|
||||
|
||||
pushScope();
|
||||
|
||||
if (isInFunction)
|
||||
isInLocalFunction = true;
|
||||
else
|
||||
isInFunction = true;
|
||||
|
||||
super.visit(unitTestDecl);
|
||||
popScope();
|
||||
|
||||
isInFunction = oldIsInFunction;
|
||||
isInLocalFunction = oldIsInLocalFunction;
|
||||
}
|
||||
|
||||
private:
|
||||
extern (D) Thing[string][] stack;
|
||||
int conditionalDepth;
|
||||
|
|
|
|||
Loading…
Reference in New Issue