Index: modules/simpletest/tests/unicode.test
===================================================================
RCS file: modules/simpletest/tests/unicode.test
diff -N modules/simpletest/tests/unicode.test
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ modules/simpletest/tests/unicode.test	13 Nov 2008 01:43:01 -0000
@@ -0,0 +1,80 @@
+<?php
+// $Id$
+
+/**
+ * Test the decode_entities() function.
+ */
+class DecodeEntitiesTestCase extends DrupalWebTestCase {
+
+  /**
+   * Implementation of getInfo().
+   */
+  function getInfo() {
+    return array(
+      'name' => t('Decode entities test'),
+      'description' => t('Performs several tests with the decode_entities() function, and makes sure the result is as expected.'),
+      'group' => t('System'),
+    );
+  }
+
+  /**
+   * Test to make sure when we run decode_entities() on certain values, we get
+   * the expected results.
+   */
+  function testDecodeEntities() {
+    $expectations = array(
+      'Drupal' => 'Drupal',
+      '<script>' => '<script>',
+      '&lt;script&gt;' => '<script>',
+      '&amp;lt;script&amp;gt;' => '&lt;script&gt;',
+      '"' => '"',
+      '&#34;' => '"',
+      '&amp;#34;' => '&#34;',
+      '&quot;' => '"',
+      '&amp;quot;' => '&quot;',
+      "'" => "'",
+      '&#39;' => "'",
+      '&amp;#39;' => '&#39;',
+      '©' => '©',
+      '&copy;' => '©',
+      '&#169;' => '©',
+      '→' => '→',
+      '&#8594;' => '→',
+      '➼' => '➼',
+      '&#10172;' => '➼',
+    );
+    foreach ($expectations as $initial => $expected) {
+      $result = decode_entities($initial);
+      $this->assertIdentical($expected, $result, t('Make sure the decoded entity of @initial is @expected. (Got @result)', array('@initial' => $initial, '@expected' => $expected, '@result' => $result)));
+    }
+  }
+
+  function testDecodeEntitiesExclusion() {
+    $expectations = array(
+      'Drupal' => 'Drupal',
+      '<script>' => '<script>',
+      '&lt;script&gt;' => '&lt;script>',
+      '&amp;lt;script&amp;gt;' => '&amp;lt;script&amp;gt;',
+      '"' => '"',
+      '&#34;' => '&#34;',
+      '&amp;#34;' => '&amp;#34;',
+      '&quot;' => '&quot;',
+      '&amp;quot;' => '&amp;quot;',
+      "'" => "'",
+      '&#39;' => "'",
+      '&amp;#39;' => '&amp;#39;',
+      '©' => '©',
+      '&copy;' => '©',
+      '&#169;' => '©',
+      '→' => '→',
+      '&#8594;' => '→',
+      '➼' => '➼',
+      '&#10172;' => '➼',
+    );
+    $exclude = array('<', '&', '"');
+    foreach ($expectations as $initial => $expected) {
+      $result = decode_entities($initial, $exclude);
+      $this->assertIdentical($expected, $result, t('Make sure the decoded entity of @initial , excluding @excludes, is @expected. (Got @result)', array('@initial' => $initial, '@excludes' => implode(',', $exclude), '@expected' => $expected, '@result' => $result)));
+    }
+  }
+}
\ No newline at end of file
