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

Side by Side Diff: test/transformer_test.dart

Issue 1018643002: change to source-order crawling of directives instead of alphabetical (Closed) Base URL: git@github.com:dart-lang/static-init.git@master
Patch Set: switch to bug fix instead of breaking change, and use definingCompilationUnit Created 5 years, 9 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
« no previous file with comments | « test/parts/foo.dart ('k') | tool/all_tests.sh » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library initialize.transformer_test; 4 library initialize.transformer_test;
5 5
6 import 'common.dart'; 6 import 'common.dart';
7 import 'package:analyzer/src/generated/element.dart'; 7 import 'package:analyzer/src/generated/element.dart';
8 import 'package:dart_style/dart_style.dart'; 8 import 'package:dart_style/dart_style.dart';
9 import 'package:initialize/transformer.dart'; 9 import 'package:initialize/transformer.dart';
10 import 'package:unittest/compact_vm_config.dart'; 10 import 'package:unittest/compact_vm_config.dart';
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 initializers.addAll([ 273 initializers.addAll([
274 new InitEntry(i2.constInit, const LibraryIdentifier(#bar, null, 'foo /bar.dart')), 274 new InitEntry(i2.constInit, const LibraryIdentifier(#bar, null, 'foo /bar.dart')),
275 new InitEntry(i2.constInit, i1.bar), 275 new InitEntry(i2.constInit, i1.bar),
276 new InitEntry(i2.constInit, i1.Bar), 276 new InitEntry(i2.constInit, i1.Bar),
277 ]); 277 ]);
278 278
279 i0.main(); 279 i0.main();
280 } 280 }
281 ''') 281 ''')
282 }, []); 282 }, []);
283
284 testPhases('library parts and exports', phases, {
285 'a|web/index.dart': '''
286 @constInit
287 library index;
288
289 import 'package:test_initializers/common.dart';
290 export 'export.dart';
291
292 part 'foo.dart';
293 part 'bar.dart';
294
295 @constInit
296 index() {};
297
298 @constInit
299 class Index {};
300 ''',
301 'a|web/foo.dart': '''
302 part of index;
303
304 @constInit
305 foo() {};
306
307 @constInit
308 class Foo {};
309 ''',
310 'a|web/bar.dart': '''
311 part of index;
312
313 @constInit
314 bar() {};
315
316 @constInit
317 class Bar {};
318 ''',
319 'a|web/export.dart': '''
320 @constInit
321 library export;
322
323 import 'package:test_initializers/common.dart';
324
325 @constInit
326 class Export {};
327 ''',
328 // Mock out the Initialize package plus some initializers.
329 'initialize|lib/initialize.dart': mockInitialize,
330 'test_initializers|lib/common.dart': commonInitializers,
331 }, {
332 'a|web/index.initialize.dart': formatter.format('''
333 import 'package:initialize/src/static_loader.dart';
334 import 'package:initialize/initialize.dart';
335 import 'index.dart' as i0;
336 import 'export.dart' as i1;
337 import 'package:test_initializers/common.dart' as i2;
338
339 main() {
340 initializers.addAll([
341 new InitEntry(i2.constInit, const LibraryIdentifier(#export, null, ' export.dart')),
342 new InitEntry(i2.constInit, i1.Export),
343 new InitEntry(i2.constInit, const LibraryIdentifier(#index, null, 'i ndex.dart')),
344 new InitEntry(i2.constInit, i0.bar),
345 new InitEntry(i2.constInit, i0.foo),
346 new InitEntry(i2.constInit, i0.index),
347 new InitEntry(i2.constInit, i0.Bar),
348 new InitEntry(i2.constInit, i0.Foo),
349 new InitEntry(i2.constInit, i0.Index),
350 ]);
351
352 i0.main();
353 }
354 ''')
355 }, []);
283 } 356 }
284 357
285 class SkipConstructorsPlugin extends InitializerPlugin { 358 class SkipConstructorsPlugin extends InitializerPlugin {
286 bool shouldApply(InitializerPluginData data) { 359 bool shouldApply(InitializerPluginData data) {
287 return data.initializer.annotationElement.element is ConstructorElement; 360 return data.initializer.annotationElement.element is ConstructorElement;
288 } 361 }
289 362
290 String apply(_) => null; 363 String apply(_) => null;
291 } 364 }
292 365
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 initializers.addAll([ 409 initializers.addAll([
337 new InitEntry(i2.initMethod, i1.foo), 410 new InitEntry(i2.initMethod, i1.foo),
338 new InitEntry(i2.initMethod, i0.index), 411 new InitEntry(i2.initMethod, i0.index),
339 ]); 412 ]);
340 413
341 i0.main(); 414 i0.main();
342 } 415 }
343 ''') 416 ''')
344 }, []); 417 }, []);
345 } 418 }
OLDNEW
« no previous file with comments | « test/parts/foo.dart ('k') | tool/all_tests.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698