[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    tests/khtmltests/regression/tests/js
From:       Harri Porten <porten () kde ! org>
Date:       2008-04-18 23:37:10
Message-ID: 1208561830.633071.6597.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 798718 by porten:

Testing for two problems fixed by current libpcre.


 M  +13 -0     RegExp.js  


--- trunk/tests/khtmltests/regression/tests/js/RegExp.js #798717:798718
@@ -91,12 +91,25 @@
 shouldBe("'foo+bar'.replace(/\\+/g,'%2B')", "'foo%2Bbar'");
 var caught = false; try { new RegExp("+"); } catch (e) { caught = true; }
 shouldBeTrue("caught"); // #40435
+var caught = false; try { new RegExp("]"); } catch (e) { caught = true; }
+shouldBeTrue("caught"); // test 89 of Acid3
+var caught = false; try { new RegExp("\\]"); } catch (e) { caught = true; }
+shouldBeFalse("caught");
 shouldBe("'foo'.replace(/z?/g,'x')", "'xfxoxox'");
 shouldBe("'test test'.replace(/\\s*/g,'')","'testtest'"); // #50985
 shouldBe("'abc$%@'.replace(/[^0-9a-z]*/gi,'')","'abc'"); // #50848
 shouldBe("'ab'.replace(/[^\\d\\.]*/gi,'')","''"); // #75292
 shouldBe("'1ab'.replace(/[^\\d\\.]*/gi,'')","'1'"); // #75292
 
+// Acid3 showed a difference to the Perl regex behavior
+var x = /(\3)(\1)(a)/.exec('cat'); // the \3 matches the empty string, qv. ES3:15.10.2.9
+shouldBeTrue("!!x"); // or, "/(\\3)(\\1)(a)/ failed to match 'cat'");
+shouldBe("x.length", "4"); // or, "/(\\3)(\\1)(a)/ failed to return four components");
+shouldBe("x[0]", "'a'"); // or, "/(\\3)(\\1)(a)/ failed to find 'a' in 'cat'");
+shouldBe("x[1]", "''"); // or, "/(\\3)(\\1)(a)/ failed to find '' in 'cat' as first part");
+shouldBe("x[2]", "''"); // or, "/(\\3)(\\1)(a)/ failed to find '' in 'cat' as second part");
+shouldBe("x[3]", "'a'"); // or, "/(\\3)(\\1)(a)/ failed to find 'a' in 'cat' as third part");
+
 shouldBe("'1test2test3blah'.split(/test/).toString()","'1,2,3blah'");
 var reg = /(\d\d )/g;
 var str = new String('98 76 blah');
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic