Permalink
Browse files

MDL-30741 Adding a new test to check for incorrect parsing of complic…

…ate HTML with a PRE tag.
  • Loading branch information...
1 parent e60d8e5 commit e0b587be49246206cf6690a321e94666ef7a323a @jfilip jfilip committed Dec 14, 2011
Showing with 21 additions and 0 deletions.
  1. +21 −0 lib/simpletest/testweblib.php
View
21 lib/simpletest/testweblib.php
@@ -139,6 +139,27 @@ public function test_html_to_text_0() {
$this->assertIdentical('0', html_to_text('0'));
}
+ public function test_html_to_text_pre_parsing_problem() {
+ $strorig = 'Consider the following function:<br /><pre><span style="color: rgb(153, 51, 102);">void FillMeUp(char* in_string) {'.
+ '<br /> int i = 0;<br /> while (in_string[i] != \'\0\') {<br /> in_string[i] = \'X\';<br /> i++;<br /> }<br />'.
+ '}</span></pre>What would happen if a non-terminated string were input to this function?<br /><br />';
+
+ $strconv = 'Consider the following function:
+
+void FillMeUp(char* in_string) {
+ int i = 0;
+ while (in_string[i] != \'\0\') {
+ in_string[i] = \'X\';
+ i++;
+ }
+}
+What would happen if a non-terminated string were input to this function?
+
+';
+
+ $this->assertIdentical($strconv, html_to_text($strorig));
+ }
+
public function test_clean_text() {
$text = "lala <applet>xx</applet>";
$this->assertEqual($text, clean_text($text, FORMAT_PLAIN));

0 comments on commit e0b587b

Please sign in to comment.