| 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('dart:uri'); | 5 #import('dart:uri'); |
| 6 #import('parser_helper.dart'); | 6 #import('parser_helper.dart'); |
| 7 #import("../../../lib/compiler/compiler.dart"); | 7 #import("../../../lib/compiler/compiler.dart"); |
| 8 #import("../../../lib/compiler/implementation/tree/tree.dart"); | 8 #import("../../../lib/compiler/implementation/tree/tree.dart"); |
| 9 | 9 |
| 10 testUnparse(String statement) { | 10 testUnparse(String statement) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 compile( | 69 compile( |
| 70 scriptUri, | 70 scriptUri, |
| 71 fileUri('libraryRoot'), | 71 fileUri('libraryRoot'), |
| 72 fileUri('packageRoot'), | 72 fileUri('packageRoot'), |
| 73 provider, | 73 provider, |
| 74 handler, | 74 handler, |
| 75 const ['--output-type=dart', '--unparse-validation']).then(continuation); | 75 const ['--output-type=dart', '--unparse-validation']).then(continuation); |
| 76 } | 76 } |
| 77 | 77 |
| 78 testSignedConstants() { |
| 79 testUnparse('var x=+42;'); |
| 80 testUnparse('var x=+.42;'); |
| 81 testUnparse('var x=-42;'); |
| 82 testUnparse('var x=-.42;'); |
| 83 testUnparse('var x=+0;'); |
| 84 testUnparse('var x=+0.0;'); |
| 85 testUnparse('var x=+.0;'); |
| 86 testUnparse('var x=-0;'); |
| 87 testUnparse('var x=-0.0;'); |
| 88 testUnparse('var x=-.0;'); |
| 89 } |
| 90 |
| 78 testGenericTypes() { | 91 testGenericTypes() { |
| 79 testUnparse('var x=new List<List<int>>();'); | 92 testUnparse('var x=new List<List<int>>();'); |
| 80 testUnparse('var x=new List<List<List<int>>>();'); | 93 testUnparse('var x=new List<List<List<int>>>();'); |
| 81 testUnparse('var x=new List<List<List<List<int>>>>();'); | 94 testUnparse('var x=new List<List<List<List<int>>>>();'); |
| 82 testUnparse('var x=new List<List<List<List<List<int>>>>>();'); | 95 testUnparse('var x=new List<List<List<List<List<int>>>>>();'); |
| 83 } | 96 } |
| 84 | 97 |
| 85 testForLoop() { | 98 testForLoop() { |
| 86 testUnparse('for(;i<100;i++){}'); | 99 testUnparse('for(;i<100;i++){}'); |
| 87 testUnparse('for(i=0;i<100;i++){}'); | 100 testUnparse('for(i=0;i<100;i++){}'); |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 var expectedResult = @'topfoo(){}$topfoo(){var x=5;}A getA()=> null;' | 380 var expectedResult = @'topfoo(){}$topfoo(){var x=5;}A getA()=> null;' |
| 368 @'main(){var a=new A(); a.foo(); var b=new $A.fromFoo(); b.foo(); ' | 381 @'main(){var a=new A(); a.foo(); var b=new $A.fromFoo(); b.foo(); ' |
| 369 @'var GREATVAR=b.myliba; b.mylist; a=getA(); $topfoo(); topfoo();}' | 382 @'var GREATVAR=b.myliba; b.mylist; a=getA(); $topfoo(); topfoo();}' |
| 370 @'class $A{$A.fromFoo(){}List<$A> mylist;num foo(){}A myliba;}' | 383 @'class $A{$A.fromFoo(){}List<$A> mylist;num foo(){}A myliba;}' |
| 371 @'class A{foo(){}}'; | 384 @'class A{foo(){}}'; |
| 372 testDart2DartWithLibrary(mainSrc, librarySrc, | 385 testDart2DartWithLibrary(mainSrc, librarySrc, |
| 373 (String result) { Expect.equals(expectedResult, result); }); | 386 (String result) { Expect.equals(expectedResult, result); }); |
| 374 } | 387 } |
| 375 | 388 |
| 376 main() { | 389 main() { |
| 390 testSignedConstants(); |
| 377 testGenericTypes(); | 391 testGenericTypes(); |
| 378 testForLoop(); | 392 testForLoop(); |
| 379 testEmptyList(); | 393 testEmptyList(); |
| 380 testClosure(); | 394 testClosure(); |
| 381 testIndexedOperatorDecl(); | 395 testIndexedOperatorDecl(); |
| 382 testNativeMethods(); | 396 testNativeMethods(); |
| 383 testPrefixIncrements(); | 397 testPrefixIncrements(); |
| 384 testConstModifier(); | 398 testConstModifier(); |
| 385 testSimpleFileUnparse(); | 399 testSimpleFileUnparse(); |
| 386 testSimpleObjectInstantiation(); | 400 testSimpleObjectInstantiation(); |
| 387 testSimpleTopLevelClass(); | 401 testSimpleTopLevelClass(); |
| 388 testClassWithSynthesizedConstructor(); | 402 testClassWithSynthesizedConstructor(); |
| 389 testClassWithMethod(); | 403 testClassWithMethod(); |
| 390 testVariableDefinitions(); | 404 testVariableDefinitions(); |
| 391 testGetSet(); | 405 testGetSet(); |
| 392 testFactoryConstructor(); | 406 testFactoryConstructor(); |
| 393 testTopLevelField(); | 407 testTopLevelField(); |
| 394 testAbstractClass(); | 408 testAbstractClass(); |
| 395 testConflictLibraryClassRename(); | 409 testConflictLibraryClassRename(); |
| 396 testNoConflictSendsRename(); | 410 testNoConflictSendsRename(); |
| 397 testConflictSendsRename(); | 411 testConflictSendsRename(); |
| 398 } | 412 } |
| OLD | NEW |