Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.1220
diff -u -r1.1220 common.inc
--- includes/common.inc	15 Sep 2010 04:34:26 -0000	1.1220
+++ includes/common.inc	16 Sep 2010 14:12:47 -0000
@@ -4225,17 +4225,15 @@
  *
  * @param $module
  *   The name of a module that registered a library.
- * @param $library
- *   The name of a registered library.
+ * @param $name
+ *   The name of a registered library. If not provided, will retrieve all
+ *   available libraries defined by the module.
  * @return
  *   The definition of the requested library, if existent, or FALSE.
  *
  * @see drupal_add_library()
  * @see hook_library()
  * @see hook_library_alter()
- *
- * @todo The purpose of drupal_get_*() is completely different to other page
- *   requisite API functions; find and use a different name.
  */
 function drupal_get_library($module, $name) {
   $libraries = &drupal_static(__FUNCTION__, array());
@@ -4260,11 +4258,13 @@
     }
     $libraries[$module] = $module_libraries;
   }
-  if (empty($libraries[$module][$name])) {
-    $libraries[$module][$name] = FALSE;
+  if (isset($name)) {
+    if (!isset($libraries[$module][$name])) {
+      $libraries[$module][$name] = FALSE;
+    }
+    return $libraries[$module][$name];
   }
-
-  return $libraries[$module][$name];
+  return $libraries[$module];
 }
 
 /**
Index: modules/simpletest/tests/common.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common.test,v
retrieving revision 1.125
diff -u -r1.125 common.test
--- modules/simpletest/tests/common.test	9 Sep 2010 20:22:00 -0000	1.125
+++ modules/simpletest/tests/common.test	16 Sep 2010 14:12:47 -0000
@@ -1374,6 +1374,16 @@
     $scripts = drupal_get_js();
     $this->assertTrue(strpos($scripts, 'misc/farbtastic/farbtastic.js'), t('The attached_library property adds the additional libraries.'));
   }
+  
+  /**
+   * Tests the retrieval of libraries.
+   */
+  function testGetLibrary() {
+    $libraries = drupal_get_library('common_test');
+    $this->assertTrue(array_key_exists('farbtastic', $libraries), t('Retrieved all module libraries.'));
+    $farbtastic = drupal_get_library('common_test', 'farbtastic');
+    $this->assertEqual($farbtastic['version'], '5.3', t('Retrieved a single library.'));
+  }
 
   /**
    * Tests that the query string remains intact when adding JavaScript files
