From kde-commits Sat Apr 19 21:28:27 2008 From: Harri Porten Date: Sat, 19 Apr 2008 21:28:27 +0000 To: kde-commits Subject: tests/khtmltests/regression/tests/js Message-Id: <1208640507.676297.2909.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=120864051427762 SVN commit 798908 by porten: Testing two more differences from Perl. M +10 -0 RegExp.js --- trunk/tests/khtmltests/regression/tests/js/RegExp.js #798907:798908 @@ -110,6 +110,16 @@ 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"); +// Empty character class matches nothing +var ok = false; +try { ok = (/[]/.exec('') == null); } catch (e) { } +shouldBeTrue("ok"); + +// [^] matches anything +ok = false; +try { ok = (/[^]/.exec('x') != null); } catch (e) { } +shouldBeTrue("ok"); + shouldBe("'1test2test3blah'.split(/test/).toString()","'1,2,3blah'"); var reg = /(\d\d )/g; var str = new String('98 76 blah');