Add small test file for checkstyle (and its vim equivalent). Feel free

to complete it if you find other misses or false positives.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37430 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adrien Destugues 2010-07-08 13:11:53 +00:00
parent 630acb8436
commit 8fbd792dd8
1 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,71 @@
/* Test-file for coding style checker
* Copyright 2010, Haiku, Inc.
* Distributed under the terms of the MIT Licence
*/
// DETECTED problems
// Line longer than 80 chars
int
someveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryverylongFunctionName( int aLongParameter)
{
// Identantion with spaces instead of tabs
int a;
int b;
int c;
// Missing space after control statement
if(condition);
//Missing space at comment start
// Operator without spaces
if (a>b);
// Operator at end of line
if (a >
b)
j =
k +
i;
// Wrong line breaks around else
if (test)
{
}
else
{
}
// Less than two lines between functions
}
// Missing space before opening brace
int
aFunction(char param){
// More than two lines between blocks
}
// CORRECT things that should not be detected as violations
#include <dir/path.h>
// Not matched by 'operator at end of line'
// Below this are FALSE POSITIVES (think of it as a TODO list)
// Test-file
// Matched by 'space around operator' (should not be matched in comments)
// NOT DETECTED violations
int func()
{
if (a)
{
// The brace should be on the same line as the if
}
// Everything related to naming conventions
}