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

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

Issue 750323003: Remove js.ArrayElement. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add parsing and testing of array holes, make lists non-growable Created 6 years, 1 month 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_parser_test.dart
diff --git a/tests/compiler/dart2js/js_parser_test.dart b/tests/compiler/dart2js/js_parser_test.dart
index a5f923b989edb2057a08d63ccba4d5c9fd47028f..badd0bd0526e732872dddee3ca35874b939e831b 100644
--- a/tests/compiler/dart2js/js_parser_test.dart
+++ b/tests/compiler/dart2js/js_parser_test.dart
@@ -10,12 +10,15 @@ import 'package:compiler/src/js/js.dart' as jsAst;
import 'package:compiler/src/js/js.dart' show js;
Future testExpression(String expression, [String expect = ""]) {
+ print("About to parse $expression");
floitsch 2014/12/01 13:03:29 Remove debug prints.
sigurdm 2014/12/02 09:27:31 Done.
jsAst.Node node = js(expression);
+ print("");
return MockCompiler.create((MockCompiler compiler) {
String jsText =
jsAst.prettyPrint(node,
compiler,
allowVariableMinification: false).getText();
+ print("got '$jsText'");
if (expect == "") {
Expect.stringEquals(expression, jsText);
} else {
@@ -174,11 +177,13 @@ void main() {
testExpression("[]"),
testError("[42 42]"),
testExpression('beebop([1, 2, 3])'),
- // *We can't parse array literals with holes in them.
- testError("[1,, 2]"),
- testError("[1,]"),
- testError("[,]"),
- testError("[, 42]"),
+ // Array literals with holes in them.
+ testExpression("[1,, 2]"),
+ testExpression("[1,]", "[1]"),
+ testExpression("[1,,]", "[1,,]"),
+ testExpression("[,]"),
+ testExpression("[,,]"),
+ testExpression("[, 42]"),
// Ternary operator.
testExpression("x = a ? b : c"),
testExpression("y = a == null ? b : a"),

Powered by Google App Engine
This is Rietveld 408576698