Index: modules/simpletest/tests/custom_rewrite_url_inbound.inc
===================================================================
RCS file: modules/simpletest/tests/custom_rewrite_url_inbound.inc
diff -N modules/simpletest/tests/custom_rewrite_url_inbound.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/simpletest/tests/custom_rewrite_url_inbound.inc	12 Oct 2008 02:23:49 -0000
@@ -0,0 +1,9 @@
+<?php
+function custom_url_rewrite_inbound(&$result, $path, $path_language) {
+  global $user;
+  if (preg_match('|^foobar(/.*)|', $path, $matches)) {
+      $result = 'node'. $matches[1];
+  }
+
+}
+?>
Index: modules/simpletest/tests/custom_rewrite_url_inbound.test
===================================================================
RCS file: modules/simpletest/tests/custom_rewrite_url_inbound.test
diff -N modules/simpletest/tests/custom_rewrite_url_inbound.test
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/simpletest/tests/custom_rewrite_url_inbound.test	12 Oct 2008 02:23:49 -0000
@@ -0,0 +1,42 @@
+<?php
+
+class pathTest extends DrupalWebTestCase {
+
+  function getInfo() {
+    return array(
+      'name' => t('Custom url rewrite inbound test'),
+      'description' => t('Test inclusion of custom_url_rewrite_inbound function.'),
+      'group' => t('Path'),
+    );
+  }
+
+  function testCustomUrlRewriteInboundWithoutFunction() {
+    $id = $this->randomName();
+    $inbound_path = 'foobar/' . $id;
+    $real_path    = 'node/' . $id;
+
+    $found_path = drupal_get_normal_path($inbound_path);
+    $this->assertNotEqual($found_path, $real_path, t('Inbound path does not get rewritten because the function is not yet included.'));
+  }
+
+  function testCustomUrlRewriteInbound() {
+    // This function would normally be in settings.php, so we're simulating that by including it here.
+    include(drupal_get_path('module', 'simpletest') . '/tests/custom_rewrite_url_inbound.inc');
+
+    $id = $this->randomName();
+    $inbound_path = 'foobar/' . $id;
+    $real_path    = 'node/' . $id;
+
+    $found_path = drupal_get_normal_path($inbound_path);
+    $this->assertEqual($found_path, $real_path, t('Inbound path gets rewritten when function is defined.'));
+  }
+
+  function testCustomUrlRewriteInboundNoMatch() {
+    $id = $this->randomName();
+    $inbound_path = 'no_match/' . $id;
+    $real_path    = 'node/' . $id;
+
+    $found_path = drupal_get_normal_path($inbound_path);
+    $this->assertNotEqual($found_path, $real_path, t('Inbound path does not match any of the patterns defined in the custom_url_rewrite_inbound function'));
+  }
+}
