Merge pull request #527 from WebFreak001/fix-500

fix #500
This commit is contained in:
Jan Jurzitza 2017-11-04 20:57:42 +01:00 committed by GitHub
commit f6708c48fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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.");
} }