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

Unified Diff: tests/compiler/dart2js/js_backend_cps_ir_closures_test.dart

Issue 1576093003: cpsir unittests: move all unittests into individual files and test runners. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
Index: tests/compiler/dart2js/js_backend_cps_ir_closures_test.dart
diff --git a/tests/compiler/dart2js/js_backend_cps_ir_closures_test.dart b/tests/compiler/dart2js/js_backend_cps_ir_closures_test.dart
deleted file mode 100644
index a760245ba39bffd592110ec98d64ae8901cc6f63..0000000000000000000000000000000000000000
--- a/tests/compiler/dart2js/js_backend_cps_ir_closures_test.dart
+++ /dev/null
@@ -1,316 +0,0 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// Tests of closures.
-
-library closures_test;
-
-import 'js_backend_cps_ir.dart';
-
-const List<TestEntry> tests = const [
- const TestEntry("""
-main(x) {
- a() {
- return x;
- }
- x = x + '1';
- print(a());
-}
-""",
-r"""
-function(x) {
- P.print(J.$add$ns(x, "1"));
-}"""),
-
- const TestEntry("""
-main(x) {
- a() {
- return x;
- }
- x = x + '1';
- print(a());
- return a;
-}
-""",
-r"""
-function(x) {
- var _box_0 = {}, a = new V.main_a(_box_0);
- _box_0.x = x;
- _box_0.x = J.$add$ns(_box_0.x, "1");
- P.print(a.call$0());
- return a;
-}"""),
-
- const TestEntry("""
-main(x) {
- a() {
- return x;
- }
- print(a());
-}
-""",
-r"""
-function(x) {
- P.print(x);
-}"""),
-
- const TestEntry("""
-main(x) {
- a() {
- return x;
- }
- print(a());
- return a;
-}
-""",
-r"""
-function(x) {
- var a = new V.main_a(x);
- P.print(a.call$0());
- return a;
-}"""),
-
- const TestEntry("""
-main() {
- var x = 122;
- var a = () => x;
- x = x + 1;
- print(a());
-}
-""",
-r"""
-function() {
- var v0 = H.S(122 + 1);
- if (typeof dartPrint == "function")
- dartPrint(v0);
- else if (typeof console == "object" && typeof console.log != "undefined")
- console.log(v0);
- else if (!(typeof window == "object")) {
- if (!(typeof print == "function"))
- throw "Unable to print message: " + String(v0);
- print(v0);
- }
-}"""),
-
- const TestEntry("""
-main() {
- var x = 122;
- var a = () => x;
- x = x + 1;
- print(a());
- return a;
-}
-""",
-r"""
-function() {
- var _box_0 = {}, a = new V.main_closure(_box_0), v0;
- _box_0.x = 122;
- ++_box_0.x;
- v0 = H.S(a.call$0());
- if (typeof dartPrint == "function")
- dartPrint(v0);
- else if (typeof console == "object" && typeof console.log != "undefined")
- console.log(v0);
- else if (!(typeof window == "object")) {
- if (!(typeof print == "function"))
- throw "Unable to print message: " + String(v0);
- print(v0);
- }
- return a;
-}"""),
-
- const TestEntry("""
-main() {
- var x = 122;
- var a = () {
- var y = x;
- return () => y;
- };
- x = x + 1;
- print(a()());
-}
-""",
-r"""
-function() {
- var v0 = H.S(122 + 1);
- if (typeof dartPrint == "function")
- dartPrint(v0);
- else if (typeof console == "object" && typeof console.log != "undefined")
- console.log(v0);
- else if (!(typeof window == "object")) {
- if (!(typeof print == "function"))
- throw "Unable to print message: " + String(v0);
- print(v0);
- }
-}"""),
-
- const TestEntry("""
-main() {
- var x = 122;
- var a = () {
- var y = x;
- return () => y;
- };
- x = x + 1;
- print(a()());
- return a;
-}
-""",
-r"""
-function() {
- var _box_0 = {}, a = new V.main_closure(_box_0), v0;
- _box_0.x = 122;
- ++_box_0.x;
- v0 = H.S(a.call$0().call$0());
- if (typeof dartPrint == "function")
- dartPrint(v0);
- else if (typeof console == "object" && typeof console.log != "undefined")
- console.log(v0);
- else if (!(typeof window == "object")) {
- if (!(typeof print == "function"))
- throw "Unable to print message: " + String(v0);
- print(v0);
- }
- return a;
-}"""),
-
- const TestEntry("""
-main() {
- var a;
- for (var i=0; i<10; i++) {
- a = () => i;
- }
- print(a());
-}
-""",
-r"""
-function() {
- var a = null, i = 0, v0;
- for (; i < 10; a = new V.main_closure(i), ++i)
- ;
- v0 = H.S(a.call$0());
- if (typeof dartPrint == "function")
- dartPrint(v0);
- else if (typeof console == "object" && typeof console.log != "undefined")
- console.log(v0);
- else if (!(typeof window == "object")) {
- if (!(typeof print == "function"))
- throw "Unable to print message: " + String(v0);
- print(v0);
- }
-}"""),
-
- const TestEntry("""
-class A {
- a() => 1;
- b() => () => a();
-}
-main() {
- print(new A().b()());
-}
-""",
-r"""
-function() {
- var v0 = H.S(new V.A_b_closure(V.A$()).call$0());
- if (typeof dartPrint == "function")
- dartPrint(v0);
- else if (typeof console == "object" && typeof console.log != "undefined")
- console.log(v0);
- else if (!(typeof window == "object")) {
- if (!(typeof print == "function"))
- throw "Unable to print message: " + String(v0);
- print(v0);
- }
-}"""),
-
- const TestEntry("""
-staticMethod(x) { print(x); return x; }
-main(x) {
- var tearOff = staticMethod;
- print(tearOff(123));
-}
-""",
-r"""
-function(x) {
- P.print(123);
- P.print(123);
-}"""),
-
- const TestEntry("""
-class Foo {
- instanceMethod(x) => x;
-}
-main(x) {
- var tearOff = new Foo().instanceMethod;
- print(tearOff(123));
-}
-""",
-r"""
-function(x) {
- V.Foo$();
- P.print(123);
-}"""),
-
- const TestEntry("""
-class Foo {
- instanceMethod(x) => x;
-}
-main(x) {
- var tearOff = new Foo().instanceMethod;
- print(tearOff(123));
- print(tearOff(321));
-}
-""",
-r"""
-function(x) {
- V.Foo$();
- P.print(123);
- P.print(321);
-}"""),
-
- const TestEntry("""
-class Foo {
- get getter {
- print('getter');
- return (x) => x;
- }
-}
-main(x) {
- var notTearOff = new Foo().getter;
- print(notTearOff(123));
- print(notTearOff(321));
-}
-""",
-r"""
-function(x) {
- var v0 = new V.Foo_getter_closure();
- V.Foo$();
- P.print("getter");
- P.print(v0.call$1(123));
- P.print(v0.call$1(321));
-}"""),
-
- const TestEntry("""
-class Foo {
- get getter {
- print('getter');
- return (x) => x;
- }
-}
-main(x) {
- var notTearOff = new Foo().getter;
- print(notTearOff(123));
-}
-""",
-r"""
-function(x) {
- V.Foo$();
- P.print("getter");
- P.print(new V.Foo_getter_closure().call$1(123));
-}"""),
-];
-
-void main() {
- runTests(tests);
-}

Powered by Google App Engine
This is Rietveld 408576698