diff --git a/src/tools/checkstyle/test.cpp b/src/tools/checkstyle/test.cpp new file mode 100644 index 0000000000..3d3c6593e1 --- /dev/null +++ b/src/tools/checkstyle/test.cpp @@ -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