| OLD | NEW |
| 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 | 4 |
| 5 import "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 import 'parser_helper.dart'; | 6 import 'parser_helper.dart'; |
| 7 import 'mock_compiler.dart'; | 7 import 'mock_compiler.dart'; |
| 8 import '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart'; | 8 import '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart'; |
| 9 | 9 |
| 10 testUnparse(String statement) { | 10 testUnparse(String statement) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 Expect.equals(code, unparse(node)); | 22 Expect.equals(code, unparse(node)); |
| 23 } | 23 } |
| 24 | 24 |
| 25 testUnparseTopLevelWithMetadata(String code) { | 25 testUnparseTopLevelWithMetadata(String code) { |
| 26 testUnparseUnit(code); | 26 testUnparseUnit(code); |
| 27 // TODO(ahe): Enable when supported. | 27 // TODO(ahe): Enable when supported. |
| 28 // testUnparseUnit('@foo $code'); | 28 // testUnparseUnit('@foo $code'); |
| 29 } | 29 } |
| 30 | 30 |
| 31 testSignedConstants() { | 31 testSignedConstants() { |
| 32 testUnparse('var x=+42;'); | |
| 33 testUnparse('var x=+.42;'); | |
| 34 testUnparse('var x=-42;'); | 32 testUnparse('var x=-42;'); |
| 35 testUnparse('var x=-.42;'); | 33 testUnparse('var x=-.42;'); |
| 36 testUnparse('var x=+0;'); | |
| 37 testUnparse('var x=+0.0;'); | |
| 38 testUnparse('var x=+.0;'); | |
| 39 testUnparse('var x=-0;'); | 34 testUnparse('var x=-0;'); |
| 40 testUnparse('var x=-0.0;'); | 35 testUnparse('var x=-0.0;'); |
| 41 testUnparse('var x=-.0;'); | 36 testUnparse('var x=-.0;'); |
| 42 } | 37 } |
| 43 | 38 |
| 44 testGenericTypes() { | 39 testGenericTypes() { |
| 45 testUnparse('var x=new List<List<int>>();'); | 40 testUnparse('var x=new List<List<int>>();'); |
| 46 testUnparse('var x=new List<List<List<int>>>();'); | 41 testUnparse('var x=new List<List<List<int>>>();'); |
| 47 testUnparse('var x=new List<List<List<List<int>>>>();'); | 42 testUnparse('var x=new List<List<List<List<int>>>>();'); |
| 48 testUnparse('var x=new List<List<List<List<List<int>>>>>();'); | 43 testUnparse('var x=new List<List<List<List<List<int>>>>>();'); |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 ["foo()", "void bar()", "int baz(a)", "int boz(int a,int b)=null"]); | 330 ["foo()", "void bar()", "int baz(a)", "int boz(int a,int b)=null"]); |
| 336 testUnparseParameters( | 331 testUnparseParameters( |
| 337 ["this.foo()", | 332 ["this.foo()", |
| 338 //"void this.bar()", // Commented out due to Issue 7852 | 333 //"void this.bar()", // Commented out due to Issue 7852 |
| 339 //"int this.baz(a)", // Commented out due to Issue 7852 | 334 //"int this.baz(a)", // Commented out due to Issue 7852 |
| 340 //"int this.boz(int a,int b)=null" // Commented out due to Issue 7852 | 335 //"int this.boz(int a,int b)=null" // Commented out due to Issue 7852 |
| 341 ]); | 336 ]); |
| 342 } | 337 } |
| 343 | 338 |
| 344 testSymbolLiterals() { | 339 testSymbolLiterals() { |
| 345 testUnparse("#+;"); | 340 testUnparse("#+;"); |
| 346 testUnparse("#-;"); | 341 testUnparse("#-;"); |
| 347 testUnparse("#*;"); | 342 testUnparse("#*;"); |
| 348 testUnparse("#/;"); | 343 testUnparse("#/;"); |
| 349 testUnparse("#~/;"); | 344 testUnparse("#~/;"); |
| 350 testUnparse("#%;"); | 345 testUnparse("#%;"); |
| 351 testUnparse("#<;"); | 346 testUnparse("#<;"); |
| 352 testUnparse("#<=;"); | 347 testUnparse("#<=;"); |
| 353 testUnparse("#>;"); | 348 testUnparse("#>;"); |
| 354 testUnparse("#>=;"); | 349 testUnparse("#>=;"); |
| 355 testUnparse("#==;"); | 350 testUnparse("#==;"); |
| 356 testUnparse("#&;"); | 351 testUnparse("#&;"); |
| 357 testUnparse("#|;"); | 352 testUnparse("#|;"); |
| 358 testUnparse("#^;"); | 353 testUnparse("#^;"); |
| 359 | 354 |
| 360 testUnparse("#a;"); | 355 testUnparse("#a;"); |
| 361 testUnparse("#a.b;"); | 356 testUnparse("#a.b;"); |
| 362 testUnparse("#a.b.c;"); | 357 testUnparse("#a.b.c;"); |
| 363 testUnparse("#aa.bb.cc.dd;"); | 358 testUnparse("#aa.bb.cc.dd;"); |
| 364 } | 359 } |
| 365 | 360 |
| 366 main() { | 361 main() { |
| 367 testSignedConstants(); | 362 testSignedConstants(); |
| 368 testGenericTypes(); | 363 testGenericTypes(); |
| 369 testForLoop(); | 364 testForLoop(); |
| 370 testEmptyList(); | 365 testEmptyList(); |
| 371 testClosure(); | 366 testClosure(); |
| 372 testIndexedOperatorDecl(); | 367 testIndexedOperatorDecl(); |
| 373 testNativeMethods(); | 368 testNativeMethods(); |
| 374 testPrefixIncrements(); | 369 testPrefixIncrements(); |
| 375 testConstModifier(); | 370 testConstModifier(); |
| 376 testSimpleObjectInstantiation(); | 371 testSimpleObjectInstantiation(); |
| 377 testLibraryName(); | 372 testLibraryName(); |
| 378 testImport(); | 373 testImport(); |
| 379 testExport(); | 374 testExport(); |
| 380 testPart(); | 375 testPart(); |
| 381 testPartOf(); | 376 testPartOf(); |
| 382 testCombinators(); | 377 testCombinators(); |
| 383 testRedirectingFactoryConstructors(); | 378 testRedirectingFactoryConstructors(); |
| 384 testClassDeclarations(); | 379 testClassDeclarations(); |
| 385 testMixinApplications(); | 380 testMixinApplications(); |
| 386 testParameters(); | 381 testParameters(); |
| 387 testSymbolLiterals(); | 382 testSymbolLiterals(); |
| 388 } | 383 } |
| OLD | NEW |