Index: modules/simpletest/tests/common.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common.test,v
retrieving revision 1.46
diff -u -r1.46 common.test
--- modules/simpletest/tests/common.test	12 Jun 2009 08:39:39 -0000	1.46
+++ modules/simpletest/tests/common.test	17 Jun 2009 18:56:31 -0000
@@ -9,7 +9,7 @@
   public static function getInfo() {
     return array(
       'name' => t('Tests for the l() function'),
-      'description' => t('Confirm that url() works correctly with various input.'),
+      'description' => t('Confirm that l() and url() work correctly with various input.'),
       'group' => t('System'),
     );
   }
@@ -24,6 +24,28 @@
     $sanitized_path = check_url(url($path));
     $this->assertTrue(strpos($link, $sanitized_path) != FALSE, t('XSS attack @path was filtered', array('@path' => $path)));
   }
+  
+  /**
+   * Tests for active class in l() function.
+   */
+  function testLActiveClass() {
+    $link = l($this->randomName(), $_GET['q']);
+    $this->assertTrue($this->hasClass($link, 'active'), t('Class @class is present on link to the current page', array('@class' => 'active')));
+  }
+
+  /**
+   * Tests for custom class in l() function.
+   */
+  function testLCustomClass() {
+    $class = $this->randomName();
+    $link = l($this->randomName(), $_GET['q'], array('attributes' => array('class' => $class)));
+    $this->assertTrue($this->hasClass($link, $class), t('Custom class @class is present on link to the current page', array('@class' => $class)));
+  }
+  
+  private function hasClass($link, $class) {
+    return preg_match('|class=.*[\"\'\s]' . $class . '[\"\'\s]|i', $link);
+  }
+  
 }
 
 class CommonSizeTestCase extends DrupalUnitTestCase {
@@ -862,5 +884,4 @@
       $this->assertEqual($error['message'], $message, t("Message was %message", array('%message' => $message)));
     }
   }
-}
-
+}
\ No newline at end of file
