? test.patch
Index: common.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common.test,v
retrieving revision 1.138
diff -u -p -r1.138 common.test
--- common.test	15 Dec 2010 04:21:39 -0000	1.138
+++ common.test	23 Dec 2010 15:48:13 -0000
@@ -2020,6 +2020,28 @@ class ParseInfoFilesTestCase extends Dru
 }
 
 /**
+ * Test the drupal_build_info_file() API function.
+ */
+class BuildInfoFilesTestCase extends DrupalWebTestCase {
+  public static function getInfo() {
+    return array(
+      'name' => 'Generating .info files',
+      'description' => 'Tests generating .info files.',
+      'group' => 'System',
+    );
+  }
+
+  /**
+   * Parse an example .info file, generate the content of the .info back and check if the result of its parsing is equal to the originally parsed file.
+   */
+  function testGenerateInfoFile() {
+    $info_values = drupal_parse_info_file(drupal_get_path('module', 'simpletest') . '/tests/common_test_info.txt');
+    $generated_info_values = drupal_parse_info_format(drupal_build_info_file($info_values)); // Generate the .info string and parse it back
+    $this->assertEqual($info_values, $generated_info_values, t('The automatically generated .info string is parsed as the original one.'), t('System'));
+  }
+}
+
+/**
  * Tests for the drupal_system_listing() function.
  */
 class DrupalSystemListingTestCase extends DrupalWebTestCase {
Index: common_test_info.txt
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/common_test_info.txt,v
retrieving revision 1.2
diff -u -p -r1.2 common_test_info.txt
--- common_test_info.txt	30 Jan 2010 07:59:25 -0000	1.2
+++ common_test_info.txt	23 Dec 2010 15:48:13 -0000
@@ -8,3 +8,9 @@ simple_constant = WATCHDOG_INFO
 ; After parsing the .info file, 'double_colon' should hold the literal value.
 ; Parsing should not throw a fatal error or try to access a class constant.
 double_colon = dummyClassName::
+
+; Test for arrays
+key[] = "numeric array"
+key[index] = "associative array"
+key[index][] = "nested numeric array"
+key[index][index] = "nested associative array"
