Index: wp-testcase/test_admin_includes_comment.php
===================================================================
--- wp-testcase/test_admin_includes_comment.php	(revision 0)
+++ wp-testcase/test_admin_includes_comment.php	(revision 0)
@@ -0,0 +1,45 @@
+<?php
+class TestAdminComments extends _WPEmptyBlog {
+	function setUp() {
+		parent::setUp();
+		$this->author_id = $this->_make_user('editor');
+		_set_cron_array(array());
+		$this->post_ids = array();
+   }
+
+   function tearDown() {
+		parent::tearDown();
+
+		foreach ($this->post_ids as $id)
+			wp_delete_post($id);
+		wp_delete_user( $this->author_id );
+   }
+
+   function test_get_pending_comments_num() {
+      // create a couple of posts
+		$post = array(
+			'post_author' => $this->author_id,
+			'post_status' => 'publish',
+			'post_content' => rand_str(),
+			'post_title' => rand_str(),
+		);
+
+		// insert a post and make sure the ID is ok
+		$post1 = $this->post_ids[] = wp_insert_post($post);
+		$post2 = $this->post_ids[] = wp_insert_post($post);
+		$post3 = $this->post_ids[] = wp_insert_post($post);
+
+      // add a pending comment to post1
+      $commentdata = array('comment_approved'=>0, 'comment_post_ID'=>$post1, 'comment_content'=>rand_str());
+      wp_insert_comment($commentdata);
+
+      // add an approved comment to $post2
+      $commentdata = array('comment_approved'=>1, 'comment_post_ID'=>$post1, 'comment_content'=>rand_str());
+      wp_insert_comment($commentdata);
+
+      $this->assertEquals(1, get_pending_comments_num($post1));
+      $this->assertEquals(0, get_pending_comments_num($post2));
+      $this->assertEquals(0, get_pending_comments_num($post3)); // no pending comments or comments
+   }
+}
+?>
