diff --git a/core/includes/theme.inc b/core/includes/theme.inc
index 122cc63..330c448 100644
--- a/core/includes/theme.inc
+++ b/core/includes/theme.inc
@@ -2353,6 +2353,8 @@ function theme_indentation($variables) {
  */
 function theme_container($variables) {
   $element = $variables['element'];
+  // Ensure #attributes is set.
+  $element += array('#attributes' => array());
 
   // Special handling for form elements.
   if (isset($element['#array_parents'])) {
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/HtmlTagTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/HtmlTagTest.php
deleted file mode 100644
index a08e87d..0000000
--- a/core/modules/system/lib/Drupal/system/Tests/Common/HtmlTagTest.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-/**
- * @file
- * Contains \Drupal\system\Tests\Common\HtmlTagTest.
- */
-
-namespace Drupal\system\Tests\Common;
-
-use Drupal\simpletest\WebTestBase;
-
-/**
- * Tests for #type 'html_tag'.
- */
-class HtmlTagTest extends WebTestBase {
-  public static function getInfo() {
-    return array(
-      'name' => 'Render HTML tags',
-      'description' => 'Tests rendering of html_tag type renderable arrays.',
-      'group' => 'Common',
-    );
-  }
-
-  /**
-   * Tests #type 'html_tag'.
-   */
-  function testHtmlTag() {
-    // Test auto-closure meta tag generation.
-    $tag = array(
-      '#type' => 'html_tag',
-      '#tag' => 'meta',
-      '#attributes' => array(
-        'name' => 'description',
-        'content' => 'Drupal test',
-      ),
-    );
-    $this->assertEqual('<meta name="description" content="Drupal test" />' . "\n", drupal_render($tag), 'Test auto-closure meta tag generation.');
-
-    // Test title tag generation.
-    $tag = array(
-      '#type' => 'html_tag',
-      '#tag' => 'title',
-      '#value' => 'title test',
-    );
-    $this->assertEqual('<title>title test</title>' . "\n", drupal_render($tag), 'Test title tag generation.');
-  }
-}
diff --git a/core/modules/system/lib/Drupal/system/Tests/Common/RenderElementTypesTest.php b/core/modules/system/lib/Drupal/system/Tests/Common/RenderElementTypesTest.php
new file mode 100644
index 0000000..9ba4bf4
--- /dev/null
+++ b/core/modules/system/lib/Drupal/system/Tests/Common/RenderElementTypesTest.php
@@ -0,0 +1,116 @@
+<?php
+
+/**
+ * @file
+ * Contains Drupal\system\Tests\Common\RenderElementTypesTest.
+ */
+
+namespace Drupal\system\Tests\Common;
+
+use Drupal\simpletest\WebTestBase;
+
+/**
+ * Tests the markup of core render element types passed to drupal_render().
+ */
+class RenderElementTypesTest extends WebTestBase {
+  public static function getInfo() {
+    return array(
+      'name' => 'Render element types',
+      'description' => 'Tests the markup of core render element types passed to drupal_render().',
+      'group' => 'Common',
+    );
+  }
+
+  /**
+   * Asserts that an array of elements is rendered properly.
+   *
+   * @param array $elements
+   *   An array of associative arrays describing render elements and their
+   *   expected markup. Each item in $elements must contain the following:
+   *   - 'name': This human readable description will be displayed on the test
+   *     results page.
+   *   - 'value': This is the render element to test.
+   *   - 'expected': This is the expected markup for the element in 'value'.
+   */
+  function assertElements($elements) {
+    foreach($elements as $element) {
+      $this->assertIdentical(drupal_render($element['value']), $element['expected'], '"' . $element['name'] . '" input rendered correctly by drupal_render().');
+    }
+  }
+
+  /**
+   * Tests system #type 'container'.
+   */
+  function testContainer() {
+    $elements = array(
+      // Basic container with no attributes.
+      array(
+        'name' => "#type 'container' with no HTML attributes",
+        'value' => array(
+          '#type' => 'container',
+          '#markup' => 'foo',
+        ),
+        'expected' => '<div>foo</div>',
+      ),
+      // Container with a class.
+      array(
+        'name' => "#type 'container' with a class HTML attribute",
+        'value' => array(
+          '#type' => 'container',
+          '#markup' => 'foo',
+          '#attributes' => array(
+            'class' => 'bar',
+          ),
+        ),
+        'expected' => '<div class="bar">foo</div>',
+      ),
+      // Container with children.
+      array(
+        'name' => "#type 'container' with child elements",
+        'value' => array(
+          '#type' => 'container',
+          'child' => array(
+            '#markup' => 'foo',
+          ),
+        ),
+        'expected' => '<div>foo</div>',
+      ),
+    );
+
+    $this->assertElements($elements);
+  }
+
+  /**
+   * Tests system #type 'html_tag'.
+   */
+  function testHtmlTag() {
+    $elements = array(
+      // Test auto-closure meta tag generation.
+      array(
+        'name' => "#type 'html_tag' auto-closure meta tag generation",
+        'value' => array(
+          '#type' => 'html_tag',
+          '#tag' => 'meta',
+          '#attributes' => array(
+            'name' => 'description',
+            'content' => 'Drupal test',
+          ),
+        ),
+        'expected' => '<meta name="description" content="Drupal test" />' . "\n",
+      ),
+      // Test title tag generation.
+      array(
+        'name' => "#type 'html_tag' title tag generation",
+        'value' => array(
+          '#type' => 'html_tag',
+          '#tag' => 'title',
+          '#value' => 'title test',
+        ),
+        'expected' => '<title>title test</title>' . "\n",
+      ),
+    );
+
+    $this->assertElements($elements);
+  }
+
+}
