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

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

Issue 1314833003: Shared commandline flags. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 3 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 helper [Compiler.inUserCode] works as intended. 5 // Test that the helper [Compiler.inUserCode] works as intended.
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'package:async_helper/async_helper.dart'; 8 import 'package:async_helper/async_helper.dart';
9 import 'package:expect/expect.dart'; 9 import 'package:expect/expect.dart';
10 import 'package:compiler/src/commandline_options.dart';
10 import 'package:compiler/src/compiler.dart' show Compiler; 11 import 'package:compiler/src/compiler.dart' show Compiler;
11 import 'memory_compiler.dart'; 12 import 'memory_compiler.dart';
12 13
13 const SOURCE = const { 14 const SOURCE = const {
14 'main.dart': """ 15 'main.dart': """
15 library main; 16 library main;
16 17
17 import 'dart:async'; 18 import 'dart:async';
18 import 'foo.dart'; 19 import 'foo.dart';
19 import 'pkg/sub/bar.dart'; 20 import 'pkg/sub/bar.dart';
(...skipping 20 matching lines...) Expand all
40 41
41 'pkg/sup/boz.dart': """ 42 'pkg/sup/boz.dart': """
42 library sup.boz; 43 library sup.boz;
43 """, 44 """,
44 }; 45 };
45 46
46 Future test(List<Uri> entryPoints, Map<String, bool> expectedResults) async { 47 Future test(List<Uri> entryPoints, Map<String, bool> expectedResults) async {
47 CompilationResult result = await runCompiler( 48 CompilationResult result = await runCompiler(
48 entryPoints: entryPoints, 49 entryPoints: entryPoints,
49 memorySourceFiles: SOURCE, 50 memorySourceFiles: SOURCE,
50 options: ['--analyze-only', '--analyze-all'], 51 options: [Flags.analyzeOnly, Flags.analyzeAll],
51 packageRoot: Uri.parse('memory:pkg/')); 52 packageRoot: Uri.parse('memory:pkg/'));
52 Compiler compiler = result.compiler; 53 Compiler compiler = result.compiler;
53 expectedResults.forEach((String uri, bool expectedResult) { 54 expectedResults.forEach((String uri, bool expectedResult) {
54 var element = compiler.libraryLoader.lookupLibrary(Uri.parse(uri)); 55 var element = compiler.libraryLoader.lookupLibrary(Uri.parse(uri));
55 Expect.isNotNull(element, "Unknown library '$uri'."); 56 Expect.isNotNull(element, "Unknown library '$uri'.");
56 Expect.equals(expectedResult, compiler.inUserCode(element), 57 Expect.equals(expectedResult, compiler.inUserCode(element),
57 expectedResult ? "Library '$uri' expected to be in user code" 58 expectedResult ? "Library '$uri' expected to be in user code"
58 : "Library '$uri' not expected to be in user code"); 59 : "Library '$uri' not expected to be in user code");
59 }); 60 });
60 } 61 }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 'dart:core': false}); 94 'dart:core': false});
94 await test( 95 await test(
95 [Uri.parse('dart:async'), Uri.parse('package:sub/bar.dart')], 96 [Uri.parse('dart:async'), Uri.parse('package:sub/bar.dart')],
96 {'package:sub/bar.dart': true, 97 {'package:sub/bar.dart': true,
97 'package:sub/baz.dart': true, 98 'package:sub/baz.dart': true,
98 'package:sup/boz.dart': false, 99 'package:sup/boz.dart': false,
99 'dart:core': true, 100 'dart:core': true,
100 'dart:async': true}); 101 'dart:async': true});
101 } 102 }
102 103
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/frontend_checker.dart ('k') | tests/compiler/dart2js/message_kind_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698