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

List:       kde-commits
Subject:    tests/khtmltests/regression/tests/js
From:       Maks Orlovich <maksim () kde ! org>
Date:       2008-01-16 0:08:44
Message-ID: 1200442124.160797.17109.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 762053 by orlovich:

Some regression tests for String.prototype.substr


 M  +10 -0     StringObject.js  


--- trunk/tests/khtmltests/regression/tests/js/StringObject.js #762052:762053
@@ -109,6 +109,16 @@
 shouldBe("'a'.localeCompare('')", "1");
 shouldBe("'a'.localeCompare()", "0");
 
+// String.prototype.substr()
+shouldBe('"abcdef".substr(1)', '"bcdef"');
+shouldBe('"abcdef".substr(-1)', '"f"');
+shouldBe('"abcdef".substr(1, 2)', '"bc"');
+shouldBe('"abcdef".substr(-1, 2)', '"f"');
+shouldBe('"abcdef".substr(1, 0)', '""');
+shouldBe('"abcdef".substr(-1, 0)', '""');
+shouldBe('"abcdef".substr(1, NaN)', '""');
+shouldBe('"abcdef".substr(-1, NaN)', '""');
+
 // warning: prototype modification below
 shouldBe("'abc'[0]", "'a'");
 shouldBeUndefined("'abc'[-1]");
[prev in list] [next in list] [prev in thread] [next in thread] 

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