| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 /// Test that the dart2js copy of [KernelVisitor] generates the expected IR as | 5 /// Test that the dart2js copy of [KernelVisitor] generates the expected IR as |
| 6 /// defined by kernel spec-mode test files. | 6 /// defined by kernel spec-mode test files. |
| 7 | 7 |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 import 'dart:async'; | 9 import 'dart:async'; |
| 10 import 'package:compiler/src/compiler.dart' show Compiler; | 10 import 'package:compiler/src/compiler.dart' show Compiler; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 import '../memory_compiler.dart'; | 21 import '../memory_compiler.dart'; |
| 22 | 22 |
| 23 const String TESTCASE_DIR = 'pkg/kernel/testcases/'; | 23 const String TESTCASE_DIR = 'pkg/kernel/testcases/'; |
| 24 | 24 |
| 25 const List<String> SKIP_TESTS = const <String>[ | 25 const List<String> SKIP_TESTS = const <String>[ |
| 26 /// The test expects an unpatched api. | 26 /// The test expects an unpatched api. |
| 27 'external', | 27 'external', |
| 28 ]; | 28 ]; |
| 29 | 29 |
| 30 main(List<String> arguments) async { | 30 main(List<String> arguments) async { |
| 31 | |
| 32 Directory directory = new Directory('${TESTCASE_DIR}/input'); | 31 Directory directory = new Directory('${TESTCASE_DIR}/input'); |
| 33 for (FileSystemEntity file in directory.listSync()) { | 32 for (FileSystemEntity file in directory.listSync()) { |
| 34 if (file is File && file.path.endsWith('.dart')) { | 33 if (file is File && file.path.endsWith('.dart')) { |
| 35 String name = pathlib.basenameWithoutExtension(file.path); | 34 String name = pathlib.basenameWithoutExtension(file.path); |
| 36 bool selected = arguments.contains(name); | 35 bool selected = arguments.contains(name); |
| 37 if (!selected) { | 36 if (!selected) { |
| 38 if (arguments.isNotEmpty) continue; | 37 if (arguments.isNotEmpty) continue; |
| 39 if (SKIP_TESTS.contains(name)) continue; | 38 if (SKIP_TESTS.contains(name)) continue; |
| 40 } | 39 } |
| 41 | 40 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 await compiler.setupSdk(); | 77 await compiler.setupSdk(); |
| 79 | 78 |
| 80 // The visitor no longer enqueues elements that are not reachable from the | 79 // The visitor no longer enqueues elements that are not reachable from the |
| 81 // program. The mixin-full resolution transform run by the test expects to | 80 // program. The mixin-full resolution transform run by the test expects to |
| 82 // find dart.core::Iterator. | 81 // find dart.core::Iterator. |
| 83 var core = await compiler.libraryLoader.loadLibrary(Uri.parse('dart:core')); | 82 var core = await compiler.libraryLoader.loadLibrary(Uri.parse('dart:core')); |
| 84 var cls = core.implementation.localLookup('Iterator'); | 83 var cls = core.implementation.localLookup('Iterator'); |
| 85 cls.ensureResolved(compiler.resolution); | 84 cls.ensureResolved(compiler.resolution); |
| 86 return compiler; | 85 return compiler; |
| 87 } | 86 } |
| OLD | NEW |