Address @BBasile's review
This commit is contained in:
parent
7f38c87f5d
commit
1c89a01f33
|
|
@ -28,13 +28,13 @@ class ExplicitlyAnnotatedUnittestCheck : BaseAnalyzer
|
||||||
{
|
{
|
||||||
if (decl.unittest_ !is null)
|
if (decl.unittest_ !is null)
|
||||||
{
|
{
|
||||||
bool isSafeOrSystem = false;
|
bool isSafeOrSystem;
|
||||||
if (decl.attributes !is null)
|
if (decl.attributes !is null)
|
||||||
foreach (attribute; decl.attributes)
|
foreach (attribute; decl.attributes)
|
||||||
{
|
{
|
||||||
if (attribute.atAttribute !is null)
|
if (attribute.atAttribute !is null)
|
||||||
{
|
{
|
||||||
auto token = attribute.atAttribute.identifier.text;
|
const token = attribute.atAttribute.identifier.text;
|
||||||
if (token == "safe" || token == "system")
|
if (token == "safe" || token == "system")
|
||||||
{
|
{
|
||||||
isSafeOrSystem = true;
|
isSafeOrSystem = true;
|
||||||
|
|
@ -63,25 +63,12 @@ unittest
|
||||||
sac.explicitly_annotated_unittests = Check.enabled;
|
sac.explicitly_annotated_unittests = Check.enabled;
|
||||||
|
|
||||||
assertAnalyzerWarnings(q{
|
assertAnalyzerWarnings(q{
|
||||||
@safe unittest {
|
@safe unittest {}
|
||||||
|
@system unittest {}
|
||||||
|
pure nothrow @system @nogc unittest {}
|
||||||
|
|
||||||
}
|
unittest {} // [warn]: %s
|
||||||
|
pure nothrow @nogc unittest {} // [warn]: %s
|
||||||
@system unittest {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
pure nothrow @system @nogc unittest {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
unittest // [warn]: %s
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
pure nothrow @nogc unittest // [warn]: %s
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}c.format(
|
}c.format(
|
||||||
ExplicitlyAnnotatedUnittestCheck.MESSAGE,
|
ExplicitlyAnnotatedUnittestCheck.MESSAGE,
|
||||||
ExplicitlyAnnotatedUnittestCheck.MESSAGE,
|
ExplicitlyAnnotatedUnittestCheck.MESSAGE,
|
||||||
|
|
@ -91,21 +78,11 @@ unittest
|
||||||
assertAnalyzerWarnings(q{
|
assertAnalyzerWarnings(q{
|
||||||
struct Foo
|
struct Foo
|
||||||
{
|
{
|
||||||
@safe unittest {
|
@safe unittest {}
|
||||||
|
@system unittest {}
|
||||||
|
|
||||||
}
|
unittest {} // [warn]: %s
|
||||||
|
pure nothrow @nogc unittest {} // [warn]: %s
|
||||||
@system unittest {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
unittest // [warn]: %s
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
pure nothrow @nogc unittest // [warn]: %s
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}c.format(
|
}c.format(
|
||||||
ExplicitlyAnnotatedUnittestCheck.MESSAGE,
|
ExplicitlyAnnotatedUnittestCheck.MESSAGE,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue