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_comment.test,v 1.1.2.4 2009-06-24 22:27:17 snpower Exp $' ."\n"; $this->file_line = "/**\n * @file\n * Foo\n */\n"; $this->comment_header = $this->id_line . $this->file_line; } function testIdCommentLine() { $this->assertCoderPass('// $Id: coder_comment.test,v 1.1.2.4 2009-06-24 22:27:17 snpower Exp $' . "\n". $this->file_line); $this->assertCoderPass('// $Id: coder_comment.test,v 1.1.2.4 2009-06-24 22:27:17 snpower Exp $' . "\n" . $this->file_line); $this->assertCoderFail('/* $Id: coder_comment.test,v 1.1.2.4 2009-06-24 22:27:17 snpower Exp $ */' . "\n" . $this->file_line); } function testGeneralCommentStyle() { $this->assertCoderPass($this->comment_header . "/**\n * Comment.\n"); $this->assertCoderFail($this->comment_header . "/**\n* Comment.\n"); $this->assertCoderFail($this->comment_header . "/**\n *Comment.\n"); } function testHookImplementationComment() { $this->assertCoderPass($this->comment_header . "/**\n * Implementation of hook_foo().\n */"); $this->assertCoderFail($this->comment_header . "/**\n * Implementation of hook_foo()\n */"); $this->assertCoderFail($this->comment_header . "/**\n * Implementation of hook_foo\n */"); $this->assertCoderFail($this->comment_header . "/**\n * Implementation of hook_foo.\n */"); $this->assertCoderFail($this->comment_header . "/**\n * implementation of hook_foo().\n */"); $this->assertCoderFail($this->comment_header . '// Implementation of hook_foo().'); $this->assertCoderFail($this->comment_header . "/* Implementation of hook_foo().\n */"); $this->assertCoderFail($this->comment_header . "/**\n * Implemetation of hook_foo().\n */"); } function testFileDoxygenComment() { $this->assertCoderPass($this->id_line . "/**\n * @file\n * File description."); $this->assertCoderFail($this->id_line . "/**\n * @file File description."); $this->assertCoderFail($this->id_line . "/**\n * @file File description."); } function testSeeDoxygenComment() { $this->assertCoderPass($this->comment_header . "/**\n * @see some_function()"); $this->assertCoderPass($this->comment_header . "/**\n * @see some_function(), foo.tpl.php"); $this->assertCoderPass($this->comment_header . "/**\n * @see some_function(), foo.tpl.php, bar.tpl.php"); $this->assertCoderFail($this->comment_header . "/**\n * foo bar @see some_function()"); $this->assertCoderFail($this->comment_header . "/**\n * @see some_function"); $this->assertCoderFail($this->comment_header . "/**\n * @see some_function, foo.tpl.php"); $this->assertCoderFail($this->comment_header . "/**\n * @see some_function() foo.tpl.php"); $this->assertCoderFail($this->comment_header . "/**\n * @see some_function(),foo.tpl.php"); $this->assertCoderFail($this->comment_header . "/**\n * @see some_function(), foo.tpl.php bar.tpl.php"); $this->assertCoderFail($this->comment_header . "/**\n * @see some_function(),"); $this->assertCoderFail($this->comment_header . "/**\n * @see some_function()."); $this->assertCoderFail($this->comment_header . "/**\n * @see some_function(), foo.tpl.php."); $this->assertCoderFail($this->comment_header . "/**\n * @see\n * some_function()"); } }