Chromium Code Reviews| 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 'package:compiler/implementation/tree/tree.dart'; | 8 import 'package:compiler/implementation/tree/tree.dart'; |
| 9 | 9 |
| 10 testUnparse(String statement) { | 10 testUnparse(String statement) { |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 testUnparseTopLevelWithMetadata('import "lib.dart" deferred as a show b;'); | 209 testUnparseTopLevelWithMetadata('import "lib.dart" deferred as a show b;'); |
| 210 testUnparseTopLevelWithMetadata('import "lib.dart" deferred as a hide b;'); | 210 testUnparseTopLevelWithMetadata('import "lib.dart" deferred as a hide b;'); |
| 211 } | 211 } |
| 212 | 212 |
| 213 testUnparseMemberAndAsMemberOfFoo(String code) { | 213 testUnparseMemberAndAsMemberOfFoo(String code) { |
| 214 testUnparseMember(code); | 214 testUnparseMember(code); |
| 215 testUnparseTopLevelWithMetadata('class Foo{$code}'); | 215 testUnparseTopLevelWithMetadata('class Foo{$code}'); |
| 216 } | 216 } |
| 217 | 217 |
| 218 testRedirectingFactoryConstructors() { | 218 testRedirectingFactoryConstructors() { |
| 219 testUnparseMemberAndAsMemberOfFoo("factory Foo() = Bar;"); | 219 testUnparseMemberAndAsMemberOfFoo("factory Foo()=Bar;"); |
|
Johnni Winther
2014/07/25 10:22:20
Minified unparsing is tested. The unparser has bee
| |
| 220 testUnparseMemberAndAsMemberOfFoo("factory Foo() = Bar.baz;"); | 220 testUnparseMemberAndAsMemberOfFoo("factory Foo()=Bar.baz;"); |
| 221 testUnparseMemberAndAsMemberOfFoo("factory Foo() = Bar<T>;"); | 221 testUnparseMemberAndAsMemberOfFoo("factory Foo()=Bar<T>;"); |
| 222 testUnparseMemberAndAsMemberOfFoo("factory Foo() = Bar<List<T>,T>;"); | 222 testUnparseMemberAndAsMemberOfFoo("factory Foo()=Bar<List<T>,T>;"); |
| 223 testUnparseMemberAndAsMemberOfFoo("factory Foo() = Bar<T>.baz;"); | 223 testUnparseMemberAndAsMemberOfFoo("factory Foo()=Bar<T>.baz;"); |
| 224 testUnparseMemberAndAsMemberOfFoo("factory Foo() = Bar<List<T>,T>.baz;"); | 224 testUnparseMemberAndAsMemberOfFoo("factory Foo()=Bar<List<T>,T>.baz;"); |
| 225 testUnparseMemberAndAsMemberOfFoo("factory Foo() = prefix.Bar;"); | 225 testUnparseMemberAndAsMemberOfFoo("factory Foo()=prefix.Bar;"); |
| 226 testUnparseMemberAndAsMemberOfFoo("factory Foo() = prefix.Bar.baz;"); | 226 testUnparseMemberAndAsMemberOfFoo("factory Foo()=prefix.Bar.baz;"); |
| 227 testUnparseMemberAndAsMemberOfFoo("factory Foo() = prefix.Bar<T>;"); | 227 testUnparseMemberAndAsMemberOfFoo("factory Foo()=prefix.Bar<T>;"); |
| 228 testUnparseMemberAndAsMemberOfFoo("factory Foo() = prefix.Bar<List<T>,T>;"); | 228 testUnparseMemberAndAsMemberOfFoo("factory Foo()=prefix.Bar<List<T>,T>;"); |
| 229 testUnparseMemberAndAsMemberOfFoo("factory Foo() = prefix.Bar<T>.baz;"); | 229 testUnparseMemberAndAsMemberOfFoo("factory Foo()=prefix.Bar<T>.baz;"); |
| 230 testUnparseMemberAndAsMemberOfFoo( | 230 testUnparseMemberAndAsMemberOfFoo( |
| 231 "factory Foo() = prefix.Bar<List<T>,T>.baz;"); | 231 "factory Foo()=prefix.Bar<List<T>,T>.baz;"); |
| 232 testUnparseMemberAndAsMemberOfFoo("const factory Foo() = Bar;"); | 232 testUnparseMemberAndAsMemberOfFoo("const factory Foo()=Bar;"); |
| 233 testUnparseMemberAndAsMemberOfFoo("const factory Foo() = Bar.baz;"); | 233 testUnparseMemberAndAsMemberOfFoo("const factory Foo()=Bar.baz;"); |
| 234 testUnparseMemberAndAsMemberOfFoo("const factory Foo() = Bar<T>;"); | 234 testUnparseMemberAndAsMemberOfFoo("const factory Foo()=Bar<T>;"); |
| 235 testUnparseMemberAndAsMemberOfFoo("const factory Foo() = Bar<List<T>,T>;"); | 235 testUnparseMemberAndAsMemberOfFoo("const factory Foo()=Bar<List<T>,T>;"); |
| 236 testUnparseMemberAndAsMemberOfFoo("const factory Foo() = Bar<T>.baz;"); | 236 testUnparseMemberAndAsMemberOfFoo("const factory Foo()=Bar<T>.baz;"); |
| 237 testUnparseMemberAndAsMemberOfFoo( | 237 testUnparseMemberAndAsMemberOfFoo( |
| 238 "const factory Foo() = Bar<List<T>,T>.baz;"); | 238 "const factory Foo()=Bar<List<T>,T>.baz;"); |
| 239 testUnparseMemberAndAsMemberOfFoo("const factory Foo() = prefix.Bar;"); | 239 testUnparseMemberAndAsMemberOfFoo("const factory Foo()=prefix.Bar;"); |
| 240 testUnparseMemberAndAsMemberOfFoo("const factory Foo() = prefix.Bar.baz;"); | 240 testUnparseMemberAndAsMemberOfFoo("const factory Foo()=prefix.Bar.baz;"); |
| 241 testUnparseMemberAndAsMemberOfFoo("const factory Foo() = prefix.Bar<T>;"); | 241 testUnparseMemberAndAsMemberOfFoo("const factory Foo()=prefix.Bar<T>;"); |
| 242 testUnparseMemberAndAsMemberOfFoo( | 242 testUnparseMemberAndAsMemberOfFoo( |
| 243 "const factory Foo() = prefix.Bar<List<T>,T>;"); | 243 "const factory Foo()=prefix.Bar<List<T>,T>;"); |
| 244 testUnparseMemberAndAsMemberOfFoo("const factory Foo() = prefix.Bar<T>.baz;"); | 244 testUnparseMemberAndAsMemberOfFoo("const factory Foo()=prefix.Bar<T>.baz;"); |
| 245 testUnparseMemberAndAsMemberOfFoo( | 245 testUnparseMemberAndAsMemberOfFoo( |
| 246 "const factory Foo() = prefix.Bar<List<T>,T>.baz;"); | 246 "const factory Foo()=prefix.Bar<List<T>,T>.baz;"); |
| 247 testUnparseMemberAndAsMemberOfFoo("external factory Foo() = Bar;"); | 247 testUnparseMemberAndAsMemberOfFoo("external factory Foo()=Bar;"); |
| 248 testUnparseMemberAndAsMemberOfFoo("external factory Foo() = Bar.baz;"); | 248 testUnparseMemberAndAsMemberOfFoo("external factory Foo()=Bar.baz;"); |
| 249 testUnparseMemberAndAsMemberOfFoo("external factory Foo() = Bar<T>;"); | 249 testUnparseMemberAndAsMemberOfFoo("external factory Foo()=Bar<T>;"); |
| 250 testUnparseMemberAndAsMemberOfFoo("external factory Foo() = Bar<List<T>,T>;"); | 250 testUnparseMemberAndAsMemberOfFoo("external factory Foo()=Bar<List<T>,T>;"); |
| 251 testUnparseMemberAndAsMemberOfFoo("external factory Foo() = Bar<T>.baz;"); | 251 testUnparseMemberAndAsMemberOfFoo("external factory Foo()=Bar<T>.baz;"); |
| 252 testUnparseMemberAndAsMemberOfFoo( | 252 testUnparseMemberAndAsMemberOfFoo( |
| 253 "external factory Foo() = Bar<List<T>,T>.baz;"); | 253 "external factory Foo()=Bar<List<T>,T>.baz;"); |
| 254 testUnparseMemberAndAsMemberOfFoo("external factory Foo() = prefix.Bar;"); | 254 testUnparseMemberAndAsMemberOfFoo("external factory Foo()=prefix.Bar;"); |
| 255 testUnparseMemberAndAsMemberOfFoo("external factory Foo() = prefix.Bar.baz;"); | 255 testUnparseMemberAndAsMemberOfFoo("external factory Foo()=prefix.Bar.baz;"); |
| 256 testUnparseMemberAndAsMemberOfFoo("external factory Foo() = prefix.Bar<T>;"); | 256 testUnparseMemberAndAsMemberOfFoo("external factory Foo()=prefix.Bar<T>;"); |
| 257 testUnparseMemberAndAsMemberOfFoo( | 257 testUnparseMemberAndAsMemberOfFoo( |
| 258 "external factory Foo() = prefix.Bar<List<T>,T>;"); | 258 "external factory Foo()=prefix.Bar<List<T>,T>;"); |
| 259 testUnparseMemberAndAsMemberOfFoo( | 259 testUnparseMemberAndAsMemberOfFoo( |
| 260 "external factory Foo() = prefix.Bar<T>.baz;"); | 260 "external factory Foo()=prefix.Bar<T>.baz;"); |
| 261 testUnparseMemberAndAsMemberOfFoo( | 261 testUnparseMemberAndAsMemberOfFoo( |
| 262 "external factory Foo() = prefix.Bar<List<T>,T>.baz;"); | 262 "external factory Foo()=prefix.Bar<List<T>,T>.baz;"); |
| 263 testUnparseMemberAndAsMemberOfFoo("external const factory Foo() = Bar;"); | 263 testUnparseMemberAndAsMemberOfFoo("external const factory Foo()=Bar;"); |
| 264 testUnparseMemberAndAsMemberOfFoo("external const factory Foo() = Bar.baz;"); | 264 testUnparseMemberAndAsMemberOfFoo("external const factory Foo()=Bar.baz;"); |
| 265 testUnparseMemberAndAsMemberOfFoo("external const factory Foo() = Bar<T>;"); | 265 testUnparseMemberAndAsMemberOfFoo("external const factory Foo()=Bar<T>;"); |
| 266 testUnparseMemberAndAsMemberOfFoo( | 266 testUnparseMemberAndAsMemberOfFoo( |
| 267 "external const factory Foo() = Bar<List<T>,T>;"); | 267 "external const factory Foo()=Bar<List<T>,T>;"); |
| 268 testUnparseMemberAndAsMemberOfFoo( | 268 testUnparseMemberAndAsMemberOfFoo( |
| 269 "external const factory Foo() = Bar<T>.baz;"); | 269 "external const factory Foo()=Bar<T>.baz;"); |
| 270 testUnparseMemberAndAsMemberOfFoo( | 270 testUnparseMemberAndAsMemberOfFoo( |
| 271 "external const factory Foo() = Bar<List<T>,T>.baz;"); | 271 "external const factory Foo()=Bar<List<T>,T>.baz;"); |
| 272 testUnparseMemberAndAsMemberOfFoo( | 272 testUnparseMemberAndAsMemberOfFoo( |
| 273 "external const factory Foo() = prefix.Bar;"); | 273 "external const factory Foo()=prefix.Bar;"); |
| 274 testUnparseMemberAndAsMemberOfFoo( | 274 testUnparseMemberAndAsMemberOfFoo( |
| 275 "external const factory Foo() = prefix.Bar.baz;"); | 275 "external const factory Foo()=prefix.Bar.baz;"); |
| 276 testUnparseMemberAndAsMemberOfFoo( | 276 testUnparseMemberAndAsMemberOfFoo( |
| 277 "external const factory Foo() = prefix.Bar<T>;"); | 277 "external const factory Foo()=prefix.Bar<T>;"); |
| 278 testUnparseMemberAndAsMemberOfFoo( | 278 testUnparseMemberAndAsMemberOfFoo( |
| 279 "external const factory Foo() = prefix.Bar<List<T>,T>;"); | 279 "external const factory Foo()=prefix.Bar<List<T>,T>;"); |
| 280 testUnparseMemberAndAsMemberOfFoo( | 280 testUnparseMemberAndAsMemberOfFoo( |
| 281 "external const factory Foo() = prefix.Bar<T>.baz;"); | 281 "external const factory Foo()=prefix.Bar<T>.baz;"); |
| 282 testUnparseMemberAndAsMemberOfFoo( | 282 testUnparseMemberAndAsMemberOfFoo( |
| 283 "external const factory Foo() = prefix.Bar<List<T>,T>.baz;"); | 283 "external const factory Foo()=prefix.Bar<List<T>,T>.baz;"); |
| 284 } | 284 } |
| 285 | 285 |
| 286 testClassDeclarations() { | 286 testClassDeclarations() { |
| 287 testUnparseTopLevelWithMetadata('class Foo{}'); | 287 testUnparseTopLevelWithMetadata('class Foo{}'); |
| 288 testUnparseTopLevelWithMetadata('abstract class Foo{}'); | 288 testUnparseTopLevelWithMetadata('abstract class Foo{}'); |
| 289 testUnparseTopLevelWithMetadata('class Fisk{operator-(x){}}'); | 289 testUnparseTopLevelWithMetadata('class Fisk{operator-(x){}}'); |
| 290 } | 290 } |
| 291 | 291 |
| 292 testMixinApplications() { | 292 testMixinApplications() { |
| 293 testUnparseTopLevelWithMetadata('class C = S with M;'); | 293 testUnparseTopLevelWithMetadata('class C = S with M;'); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 387 testPart(); | 387 testPart(); |
| 388 testPartOf(); | 388 testPartOf(); |
| 389 testCombinators(); | 389 testCombinators(); |
| 390 testDeferredImport(); | 390 testDeferredImport(); |
| 391 testRedirectingFactoryConstructors(); | 391 testRedirectingFactoryConstructors(); |
| 392 testClassDeclarations(); | 392 testClassDeclarations(); |
| 393 testMixinApplications(); | 393 testMixinApplications(); |
| 394 testParameters(); | 394 testParameters(); |
| 395 testSymbolLiterals(); | 395 testSymbolLiterals(); |
| 396 } | 396 } |
| OLD | NEW |