This commit is contained in:
WebFreak001 2017-11-03 15:40:31 +01:00
parent c13176aec4
commit 90cc58cdb3
1 changed files with 22 additions and 3 deletions

View File

@ -42,8 +42,14 @@ class HasPublicExampleCheck : BaseAnalyzer
} }
// check all public top-level declarations // check all public top-level declarations
foreach (decl; mod.declarations.filter!(decl => isPublic(decl.attributes))) foreach (decl; mod.declarations)
{ {
if (!isPublic(decl.attributes))
{
checkLastDecl();
continue;
}
const bool hasDdocHeader = hasDdocHeader(decl); const bool hasDdocHeader = hasDdocHeader(decl);
// check the documentation of a unittest declaration // check the documentation of a unittest declaration
@ -281,14 +287,18 @@ unittest
unittest {} unittest {}
}, sac); }, sac);
/// check intermediate private declarations and ditto-ed declarations // check intermediate private declarations
assertAnalyzerWarnings(q{ // removed for issue #500
/*assertAnalyzerWarnings(q{
/// C /// C
class C{} class C{}
private void foo(){} private void foo(){}
/// ///
unittest {} unittest {}
}, sac);*/
// check intermediate ditto-ed declarations
assertAnalyzerWarnings(q{
/// I /// I
interface I{} interface I{}
/// ditto /// ditto
@ -297,6 +307,15 @@ unittest
unittest {} unittest {}
}, sac); }, sac);
// test reset on private symbols (#500)
assertAnalyzerWarnings(q{
///
void dirName(C)(C[] path) {} // [warn]: Public declaration 'dirName' has no documented example.
private void _dirName(R)(R path) {}
///
unittest {}
}, sac);
stderr.writeln("Unittest for HasPublicExampleCheck passed."); stderr.writeln("Unittest for HasPublicExampleCheck passed.");
} }