t('Coder Comment Style Tests'), 'description' => t('Tests for the coder commenting standards review.'), 'group' => t('Coder'), ); } function setUp() { parent::setUp(); $this->id_line = '// $Id: coder_review_comment.test,v 1.5 2010-12-05 17:58:30 snpower Exp $' . "\n"; $this->file_line = "/**\n * @file\n * Foo\n */\n"; $this->comment_header = $this->id_line . $this->file_line; } function testIdCommentLine() { $this->assertCoderReviewPass('// $Id: coder_review_comment.test,v 1.5 2010-12-05 17:58:30 snpower Exp $' . "\n". $this->file_line); $this->assertCoderReviewPass('// $Id: coder_review_comment.test,v 1.5 2010-12-05 17:58:30 snpower Exp $' . "\n" . $this->file_line); $this->assertCoderReviewFail('/* $Id: coder_review_comment.test,v 1.5 2010-12-05 17:58:30 snpower Exp $ */' . "\n" . $this->file_line); } function testGeneralCommentStyle() { $this->assertCoderReviewPass($this->comment_header . "/**\n * Comment.\n"); $this->assertCoderReviewFail($this->comment_header . "/**\n* Comment.\n"); $this->assertCoderReviewFail($this->comment_header . "/**\n *Comment.\n"); } function testHookImplementationComment() { $this->assertCoderReviewPass($this->comment_header . "/**\n * Implementation of hook_foo().\n */"); $this->assertCoderReviewFail($this->comment_header . "/**\n * Implementation of hook_foo()\n */"); $this->assertCoderReviewFail($this->comment_header . "/**\n * Implementation of hook_foo\n */"); $this->assertCoderReviewFail($this->comment_header . "/**\n * Implementation of hook_foo.\n */"); $this->assertCoderReviewFail($this->comment_header . "/**\n * implementation of hook_foo().\n */"); $this->assertCoderReviewFail($this->comment_header . '// Implementation of hook_foo().'); $this->assertCoderReviewFail($this->comment_header . "/* Implementation of hook_foo().\n */"); $this->assertCoderReviewFail($this->comment_header . "/**\n * Implemetation of hook_foo().\n */"); } function testFileDoxygenComment() { $this->assertCoderReviewPass($this->id_line . "/**\n * @file\n * File description."); $this->assertCoderReviewFail($this->id_line . "/**\n * @file File description."); $this->assertCoderReviewFail($this->id_line . "/**\n * @file File description."); } function testSeeDoxygenComment() { $this->assertCoderReviewPass($this->comment_header . "/**\n * @see some_function()"); $this->assertCoderReviewPass($this->comment_header . "/**\n * @see some_function(), foo.tpl.php"); $this->assertCoderReviewPass($this->comment_header . "/**\n * @see some_function(), foo.tpl.php, bar.tpl.php"); $this->assertCoderReviewFail($this->comment_header . "/**\n * foo bar @see some_function()"); $this->assertCoderReviewFail($this->comment_header . "/**\n * @see some_function"); $this->assertCoderReviewFail($this->comment_header . "/**\n * @see some_function, foo.tpl.php"); $this->assertCoderReviewFail($this->comment_header . "/**\n * @see some_function(),foo.tpl.php"); $this->assertCoderReviewFail($this->comment_header . "/**\n * @see some_function() foo.tpl.php"); $this->assertCoderReviewFail($this->comment_header . "/**\n * @see some_function(), foo.tpl.php bar.tpl.php"); $this->assertCoderReviewFail($this->comment_header . "/**\n * @see some_function(),"); $this->assertCoderReviewFail($this->comment_header . "/**\n * @see some_function()."); $this->assertCoderReviewFail($this->comment_header . "/**\n * @see some_function(), foo.tpl.php."); $this->assertCoderReviewFail($this->comment_header . "/**\n * @see\n * some_function()"); $this->assertCoderReviewFail($this->comment_header . "// @see some_function()"); } }