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

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

Issue 10828076: Support signed constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Ready for review Created 8 years, 4 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 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 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
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() {
Roman 2012/07/31 07:52:12 what about +inf, -inf, +0.0, -0.0 ?
Anton Muhin 2012/07/31 08:01:16 There is no inf, zero tests are added
79 testUnparse('var x=+42;');
80 testUnparse('var x=+.42;');
81 testUnparse('var x=-42;');
82 testUnparse('var x=-.42;');
83 }
84
78 testGenericTypes() { 85 testGenericTypes() {
79 testUnparse('var x=new List<List<int>>();'); 86 testUnparse('var x=new List<List<int>>();');
80 testUnparse('var x=new List<List<List<int>>>();'); 87 testUnparse('var x=new List<List<List<int>>>();');
81 testUnparse('var x=new List<List<List<List<int>>>>();'); 88 testUnparse('var x=new List<List<List<List<int>>>>();');
82 testUnparse('var x=new List<List<List<List<List<int>>>>>();'); 89 testUnparse('var x=new List<List<List<List<List<int>>>>>();');
83 } 90 }
84 91
85 testForLoop() { 92 testForLoop() {
86 testUnparse('for(;i<100;i++){}'); 93 testUnparse('for(;i<100;i++){}');
87 testUnparse('for(i=0;i<100;i++){}'); 94 testUnparse('for(i=0;i<100;i++){}');
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 var expectedResult = @'topfoo(){}$topfoo(){var x=5;}A getA()=> null;' 374 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(); ' 375 @'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();}' 376 @'var GREATVAR=b.myliba; b.mylist; a=getA(); $topfoo(); topfoo();}'
370 @'class $A{$A.fromFoo(){}List<$A> mylist;num foo(){}A myliba;}' 377 @'class $A{$A.fromFoo(){}List<$A> mylist;num foo(){}A myliba;}'
371 @'class A{foo(){}}'; 378 @'class A{foo(){}}';
372 testDart2DartWithLibrary(mainSrc, librarySrc, 379 testDart2DartWithLibrary(mainSrc, librarySrc,
373 (String result) { Expect.equals(expectedResult, result); }); 380 (String result) { Expect.equals(expectedResult, result); });
374 } 381 }
375 382
376 main() { 383 main() {
384 testSignedConstants();
377 testGenericTypes(); 385 testGenericTypes();
378 testForLoop(); 386 testForLoop();
379 testEmptyList(); 387 testEmptyList();
380 testClosure(); 388 testClosure();
381 testIndexedOperatorDecl(); 389 testIndexedOperatorDecl();
382 testNativeMethods(); 390 testNativeMethods();
383 testPrefixIncrements(); 391 testPrefixIncrements();
384 testConstModifier(); 392 testConstModifier();
385 testSimpleFileUnparse(); 393 testSimpleFileUnparse();
386 testSimpleObjectInstantiation(); 394 testSimpleObjectInstantiation();
387 testSimpleTopLevelClass(); 395 testSimpleTopLevelClass();
388 testClassWithSynthesizedConstructor(); 396 testClassWithSynthesizedConstructor();
389 testClassWithMethod(); 397 testClassWithMethod();
390 testVariableDefinitions(); 398 testVariableDefinitions();
391 testGetSet(); 399 testGetSet();
392 testFactoryConstructor(); 400 testFactoryConstructor();
393 testTopLevelField(); 401 testTopLevelField();
394 testAbstractClass(); 402 testAbstractClass();
395 testConflictLibraryClassRename(); 403 testConflictLibraryClassRename();
396 testNoConflictSendsRename(); 404 testNoConflictSendsRename();
397 testConflictSendsRename(); 405 testConflictSendsRename();
398 } 406 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698