Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Unified Diff: test/webkit/fast/js/kde/statements.js

Issue 21070002: Migrate more tests from blink repository. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/webkit/fast/js/kde/scope-expected.txt ('k') | test/webkit/fast/js/kde/statements-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/webkit/fast/js/kde/statements.js
diff --git a/test/webkit/do-while-semicolon.js b/test/webkit/fast/js/kde/statements.js
similarity index 51%
copy from test/webkit/do-while-semicolon.js
copy to test/webkit/fast/js/kde/statements.js
index cd7cf4c1028ce794b17dbb326b77804aec0d5ac1..ecc6c321a47f0b1a119bd7c2a8fdd27f194e66e3 100644
--- a/test/webkit/do-while-semicolon.js
+++ b/test/webkit/fast/js/kde/statements.js
@@ -21,47 +21,79 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-description(
-"This test checks that toString() round-trip on a function that has do..while in JavaScript does not insert extra semicolon."
-);
-
-function f1() {
- do {} while(0);
-}
-
-function f2() {
- do {} while(0)
-}
-
-function f3() {
- do {} while(0) ;
+description("KDE JS Test");
+function testSwitch(v) {
+ var result = "";
+ switch (v) {
+ case 0:
+ result += 'a';
+ case 1:
+        result += 'b';
+ case 1:
+ result += 'c';
+ case 2:
+ result += 'd';
+ break;
+ }
+ return result;
}
-function f4() {
- do {} while(0) /*empty*/ ;
+shouldBe("testSwitch(0)", "'abcd'");
+shouldBe("testSwitch(1)", "'bcd'"); // IE agrees, NS disagrees
+shouldBe("testSwitch(2)", "'d'");
+shouldBe("testSwitch(false)", "''");
+
+function testSwitch2(v) {
+ var result = "";
+ switch (v) {
+ case 1:
+ result += 'a';
+ break;
+ case 2:
+        result += 'b';
+ break;
+ default:
+ result += 'c';
+ case 3:
+ result += 'd';
+ break;
+ }
+ return result;
}
-
-
-if (typeof uneval == "undefined")
- uneval = function(x) { return '(' + x.toString()+ ')'; }
-
-
-uf1 = uneval(f1);
-ueuf1 = uneval(eval(uneval(f1)));
-
-uf2 = uneval(f2);
-ueuf2 = uneval(eval(uneval(f2)));
-
-uf3 = uneval(f3);
-ueuf3 = uneval(eval(uneval(f3)));
-
-uf4 = uneval(f4);
-ueuf4 = uneval(eval(uneval(f4)));
-
-
-
-shouldBe("ueuf1", "uf1");
-shouldBe("ueuf2", "uf2");
-shouldBe("ueuf3", "uf3");
-shouldBe("ueuf4", "uf4");
+shouldBe("testSwitch2(1)", "'a'");
+shouldBe("testSwitch2(2)", "'b'");
+shouldBe("testSwitch2(3)", "'d'");
+shouldBe("testSwitch2(-1)", "'cd'");
+shouldBe("testSwitch2('x')", "'cd'");
+
+function testSwitch3(v) {
+ var result = "";
+ switch (v) {
+ default:
+ result += 'c';
+ case 3:
+ result += 'd';
+ case 4:
+ result += 'e';
+ break;
+ }
+ return result;
+};
+
+shouldBe("testSwitch3(0)", "'cde'");
+shouldBe("testSwitch3(3)", "'de'");
+shouldBe("testSwitch3(4)", "'e'");
+
+function testSwitch4(v) {
+ var result = "";
+ switch (v) {
+ case 0:
+ result += 'a';
+ result += 'b';
+ break;
+ }
+ return result;
+};
+
+shouldBe("testSwitch4(0)", "'ab'");
« no previous file with comments | « test/webkit/fast/js/kde/scope-expected.txt ('k') | test/webkit/fast/js/kde/statements-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698