Index: modules/simpletest/tests/database_test.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/database_test.test,v
retrieving revision 1.81
diff -u -r1.81 database_test.test
--- modules/simpletest/tests/database_test.test	17 Feb 2010 05:24:53 -0000	1.81
+++ modules/simpletest/tests/database_test.test	18 Feb 2010 18:37:16 -0000
@@ -924,6 +924,39 @@
 }
 
 /**
+ * Tests for more complex update statements.
+ */
+class DatabaseUpdateReturnValueTestCase extends DatabaseTestCase {
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Update tests, return value',
+      'description' => 'Test the Update query return value.',
+      'group' => 'Database',
+    );
+  }
+
+  /**
+   * Tests the return value for an update query that doesn't change a row.
+   */
+  public function testReturnValueNotChanged() {
+
+    $name = db_query('SELECT name FROM {test} WHERE id = :id', array(':id' => 1))->fetchField(0);
+    $num_updated = db_update('test')
+      ->fields(array('name' => $name))
+      ->condition('id', 1)
+      ->execute();
+    $this->assertIdentical($num_updated, 1, t('Says it updated 1 record although values are the same.'));
+
+    $num_updated = db_update('test')
+      ->fields(array('name' => $name . "something else"))
+      ->condition('id', 1)
+      ->execute();
+    $this->assertIdentical($num_updated, 1, t('Says it updated 1 record when values are different'));
+  }
+}
+
+/**
  * Delete/Truncate tests.
  *
  * The DELETE tests are not as extensive, as all of the interesting code for
