From 9d9c165e7ecacec0b02ab8137c7c34e66a589ff4 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 8 Nov 2005 21:17:01 +0100 Subject: html_hilight test cases fixed darcs-hash:20051108201701-7ad00-956b228ad91dbc0f8b6c8abfaecfc5fce273b012.gz --- _test/cases/inc/html_hilight.test.php | 8 ++++---- inc/html.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/_test/cases/inc/html_hilight.test.php b/_test/cases/inc/html_hilight.test.php index 1baec416a..944c90f1e 100644 --- a/_test/cases/inc/html_hilight.test.php +++ b/_test/cases/inc/html_hilight.test.php @@ -62,8 +62,8 @@ class html_hilight_test extends UnitTestCase{ function testHighlightPHP() { $html = 'Foo $_GET[\'bar\'] Foo'; - $this->assertPattern( - '/Foo '.preg_quote('$_GET[\'bar\']').'<\/span> Foo/', + $this->assertEqual( + 'Foo $_GET[\'bar\'] Foo', html_hilight($html,'$_GET[\'bar\']') ); } @@ -78,8 +78,8 @@ class html_hilight_test extends UnitTestCase{ function testMatchAttributeWord() { $html = 'Foo bar Foo'; - $this->assertPattern( - '/Foo bar<\/b> Foo/', + $this->assertEqual( + 'Foo bar Foo', html_hilight($html,'class="x">bar') ); } diff --git a/inc/html.php b/inc/html.php index cdb8692df..41272b17f 100644 --- a/inc/html.php +++ b/inc/html.php @@ -289,7 +289,7 @@ function html_show($txt=''){ */ function html_hilight($html,$query){ //split at common delimiters - $queries = preg_split ('/[\s\'"\\\\`()\]\[?:!\.{};,#+*<>]+/',$query,-1,PREG_SPLIT_NO_EMPTY); + $queries = preg_split ('/[\s\'"\\\\`()\]\[?:!\.{};,#+*<>\\/]+/',$query,-1,PREG_SPLIT_NO_EMPTY); foreach ($queries as $q){ $q = preg_quote($q,'/'); $html = preg_replace_callback("/((<[^>]*)|$q)/i",'html_hilight_callback',$html); -- cgit v1.2.3