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 'package:compiler/src/tree/tree.dart'; | 7 import 'package:compiler/src/tree/tree.dart'; |
8 | 8 |
9 testUnparse(String statement) { | 9 testUnparse(String statement) { |
10 Node node = parseStatement(statement); | 10 Node node = parseStatement(statement); |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 testImport() { | 92 testImport() { |
93 testUnparseTopLevelWithMetadata('import "søhest";'); | 93 testUnparseTopLevelWithMetadata('import "søhest";'); |
94 testUnparseTopLevelWithMetadata('import "søhest" as fiskehest;'); | 94 testUnparseTopLevelWithMetadata('import "søhest" as fiskehest;'); |
95 } | 95 } |
96 | 96 |
97 testExport() { | 97 testExport() { |
98 testUnparseTopLevelWithMetadata('export "søhest";'); | 98 testUnparseTopLevelWithMetadata('export "søhest";'); |
99 } | 99 } |
100 | 100 |
| 101 testConditionalImport() { |
| 102 testUnparseTopLevelWithMetadata( |
| 103 'import "søhest" if(some.dotted.id)"other";'); |
| 104 testUnparseTopLevelWithMetadata( |
| 105 'import "søhest" if(id=="some str")"other";'); |
| 106 testUnparseTopLevelWithMetadata( |
| 107 'import "søhest"' |
| 108 ' if(id=="some str")"other"' |
| 109 ' if(id)"other2";'); |
| 110 testUnparseTopLevelWithMetadata( |
| 111 'import "søhest" if(some.dotted.id)"other" as fiskehest;'); |
| 112 testUnparseTopLevelWithMetadata( |
| 113 'import "søhest" if(id=="some str")"other" as fiskehest;'); |
| 114 testUnparseTopLevelWithMetadata( |
| 115 'import "søhest"' |
| 116 ' if(id=="some str")"other"' |
| 117 ' if(id)"other2"' |
| 118 ' as fiskehest;'); |
| 119 testUnparseTopLevelWithMetadata( |
| 120 'import "søhest" if(some.dotted.id)"other" deferred as fiskehest;'); |
| 121 testUnparseTopLevelWithMetadata( |
| 122 'import "søhest" if(id=="some str")"other" deferred as fiskehest;'); |
| 123 testUnparseTopLevelWithMetadata( |
| 124 'import "søhest"' |
| 125 ' if(id=="some str")"other"' |
| 126 ' if(id)"other2"' |
| 127 ' deferred as fiskehest;'); |
| 128 testUnparseTopLevelWithMetadata( |
| 129 'import "søhest"' |
| 130 ' if(id=="some str")"other"' |
| 131 ' if(id)"other2"' |
| 132 ' deferred as fiskehest' |
| 133 ' show foo,bar;'); |
| 134 } |
| 135 |
| 136 testConditionalExport() { |
| 137 testUnparseTopLevelWithMetadata( |
| 138 'export "søhest" if(some.dotted.id)"other";'); |
| 139 testUnparseTopLevelWithMetadata( |
| 140 'export "søhest" if(id=="some str")"other";'); |
| 141 testUnparseTopLevelWithMetadata( |
| 142 'export "søhest"' |
| 143 ' if(id=="some str")"other"' |
| 144 ' if(id)"other2";'); |
| 145 testUnparseTopLevelWithMetadata( |
| 146 'export "søhest"' |
| 147 ' if(id=="some str")"other"' |
| 148 ' if(id)"other2"' |
| 149 ' show foo,bar;'); |
| 150 } |
| 151 |
101 testPart() { | 152 testPart() { |
102 testUnparseTopLevelWithMetadata('part "søhest";'); | 153 testUnparseTopLevelWithMetadata('part "søhest";'); |
103 } | 154 } |
104 | 155 |
105 testPartOf() { | 156 testPartOf() { |
106 testUnparseTopLevelWithMetadata('part of com;'); | 157 testUnparseTopLevelWithMetadata('part of com;'); |
107 testUnparseTopLevelWithMetadata('part of com.example;'); | 158 testUnparseTopLevelWithMetadata('part of com.example;'); |
108 testUnparseTopLevelWithMetadata('part of com.example.dart;'); | 159 testUnparseTopLevelWithMetadata('part of com.example.dart;'); |
109 } | 160 } |
110 | 161 |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 testEmptyList(); | 427 testEmptyList(); |
377 testClosure(); | 428 testClosure(); |
378 testIndexedOperatorDecl(); | 429 testIndexedOperatorDecl(); |
379 testNativeMethods(); | 430 testNativeMethods(); |
380 testPrefixIncrements(); | 431 testPrefixIncrements(); |
381 testConstModifier(); | 432 testConstModifier(); |
382 testSimpleObjectInstantiation(); | 433 testSimpleObjectInstantiation(); |
383 testLibraryName(); | 434 testLibraryName(); |
384 testImport(); | 435 testImport(); |
385 testExport(); | 436 testExport(); |
| 437 testConditionalImport(); |
| 438 testConditionalExport(); |
386 testPart(); | 439 testPart(); |
387 testPartOf(); | 440 testPartOf(); |
388 testCombinators(); | 441 testCombinators(); |
389 testDeferredImport(); | 442 testDeferredImport(); |
390 testRedirectingFactoryConstructors(); | 443 testRedirectingFactoryConstructors(); |
391 testClassDeclarations(); | 444 testClassDeclarations(); |
392 testMixinApplications(); | 445 testMixinApplications(); |
393 testParameters(); | 446 testParameters(); |
394 testSymbolLiterals(); | 447 testSymbolLiterals(); |
395 } | 448 } |
OLD | NEW |