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

Side by Side Diff: tests/compiler/dart2js/class_codegen_test.dart

Issue 80053004: Nicer pretty printing of jsAst object literals. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated tests Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 // Test that parameters keep their names in the output. 4 // Test that parameters keep their names in the output.
5 5
6 import 'dart:async'; 6 import 'dart:async';
7 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
8 import "package:async_helper/async_helper.dart"; 8 import "package:async_helper/async_helper.dart";
9 import 'compiler_helper.dart'; 9 import 'compiler_helper.dart';
10 import 'parser_helper.dart'; 10 import 'parser_helper.dart';
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 A(a) : this.a = a {} 60 A(a) : this.a = a {}
61 } 61 }
62 62
63 main() { 63 main() {
64 new A(3); 64 new A(3);
65 } 65 }
66 """; 66 """;
67 67
68 twoClasses() { 68 twoClasses() {
69 asyncTest(() => compileAll(TEST_ONE).then((generated) { 69 asyncTest(() => compileAll(TEST_ONE).then((generated) {
70 Expect.isTrue(generated.contains('A: {"": "Object;"')); 70 Expect.isTrue(generated.contains(new RegExp('A: {[ \n]*"": "Object;"')));
71 Expect.isTrue(generated.contains('B: {"": "Object;"')); 71 Expect.isTrue(generated.contains(new RegExp('B: {[ \n]*"": "Object;"')));
72 })); 72 }));
73 } 73 }
74 74
75 subClass() { 75 subClass() {
76 checkOutput(String generated) { 76 checkOutput(String generated) {
77 Expect.isTrue(generated.contains('A: {"": "Object;"')); 77 Expect.isTrue(generated.contains(new RegExp('A: {[ \n]*"": "Object;"')));
78 Expect.isTrue(generated.contains('B: {"": "A;"')); 78 Expect.isTrue(generated.contains(new RegExp('B: {[ \n]*"": "A;"')));
79 } 79 }
80 80
81 asyncTest(() => compileAll(TEST_TWO).then(checkOutput)); 81 asyncTest(() => compileAll(TEST_TWO).then(checkOutput));
82 asyncTest(() => compileAll(TEST_THREE).then(checkOutput)); 82 asyncTest(() => compileAll(TEST_THREE).then(checkOutput));
83 } 83 }
84 84
85 fieldTest() { 85 fieldTest() {
86 asyncTest(() => compileAll(TEST_FOUR).then((generated) { 86 asyncTest(() => compileAll(TEST_FOUR).then((generated) {
87 Expect.isTrue(generated.contains(r"""B: {"": "A;y,z,x", static:""")); 87 Expect.isTrue(generated.contains(
88 new RegExp('B: {[ \n]*"": "A;y,z,x",[ \n]*static:')));
88 })); 89 }));
89 } 90 }
90 91
91 constructor1() { 92 constructor1() {
92 asyncTest(() => compileAll(TEST_FIVE).then((generated) { 93 asyncTest(() => compileAll(TEST_FIVE).then((generated) {
93 Expect.isTrue(generated.contains(new RegExp(r"new [$A-Z]+\.A\(a\);"))); 94 Expect.isTrue(generated.contains(new RegExp(r"new [$A-Z]+\.A\(a\);")));
94 })); 95 }));
95 } 96 }
96 97
97 main() { 98 main() {
98 twoClasses(); 99 twoClasses();
99 subClass(); 100 subClass();
100 fieldTest(); 101 fieldTest();
101 constructor1(); 102 constructor1();
102 } 103 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698