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

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

Issue 1945183002: Fix missing functionality with --allow-native-extensions (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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 | « pkg/compiler/lib/src/native/native.dart ('k') | no next file » | 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) 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 // Smoke test of the dart2js compiler API. 5 // Smoke test of the dart2js compiler API.
6 library analyze_only; 6 library analyze_only;
7 7
8 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
9 import 'dart:async'; 9 import 'dart:async';
10 import "package:async_helper/async_helper.dart"; 10 import "package:async_helper/async_helper.dart";
11 11
12 import '../../utils/dummy_compiler_test.dart' as dummy; 12 import '../../utils/dummy_compiler_test.dart' as dummy;
13 import 'package:compiler/compiler.dart'; 13 import 'package:compiler/compiler.dart';
14 import 'package:compiler/src/commandline_options.dart'; 14 import 'package:compiler/src/commandline_options.dart';
15 import 'package:compiler/src/diagnostics/messages.dart' show 15 import 'package:compiler/src/diagnostics/messages.dart'
16 MessageKind, MessageTemplate; 16 show MessageKind, MessageTemplate;
17 17
18 import 'output_collector.dart'; 18 import 'output_collector.dart';
19 19
20 runCompiler(String main, List<String> options, 20 runCompiler(String main, List<String> options,
21 onValue(String code, List errors, List warnings)) { 21 onValue(String code, List errors, List warnings)) {
22 List errors = new List(); 22 List errors = new List();
23 List warnings = new List(); 23 List warnings = new List();
24 24
25 Future<String> localProvider(Uri uri) { 25 Future<String> localProvider(Uri uri) {
26 if (uri.scheme != 'main') return dummy.provider(uri); 26 if (uri.scheme != 'main') return dummy.provider(uri);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 runCompiler( 168 runCompiler(
169 "", 169 "",
170 [Flags.analyzeOnly, Flags.analyzeAll], 170 [Flags.analyzeOnly, Flags.analyzeAll],
171 (String code, List errors, List warnings) { 171 (String code, List errors, List warnings) {
172 Expect.isNull(code); 172 Expect.isNull(code);
173 Expect.isTrue(errors.isEmpty); 173 Expect.isTrue(errors.isEmpty);
174 Expect.isTrue(warnings.isEmpty); 174 Expect.isTrue(warnings.isEmpty);
175 }); 175 });
176 176
177 // --analyze-signatures-only implies --analyze-only 177 // --analyze-signatures-only implies --analyze-only
178 runCompiler("", [Flags.analyzeSignaturesOnly, Flags.analyzeAll],
179 (String code, List errors, List warnings) {
180 Expect.isNull(code);
181 Expect.isTrue(errors.isEmpty);
182 Expect.isTrue(warnings.isEmpty);
183 });
184
185 // Test that --allow-native-extensions works.
178 runCompiler( 186 runCompiler(
179 "", 187 """main() {}
180 [Flags.analyzeSignaturesOnly, Flags.analyzeAll], 188 foo() native 'foo';""",
181 (String code, List errors, List warnings) { 189 [Flags.analyzeOnly, Flags.allowNativeExtensions],
182 Expect.isNull(code); 190 (String code, List errors, List warnings) {
183 Expect.isTrue(errors.isEmpty); 191 Expect.isNull(code);
184 Expect.isTrue(warnings.isEmpty); 192 Expect.isTrue(errors.isEmpty);
185 }); 193 Expect.isTrue(warnings.isEmpty);
194 });
195 runCompiler(
196 """main() {}
197 foo() native 'foo';""",
198 [Flags.analyzeOnly],
199 (String code, List errors, List warnings) {
200 Expect.isNull(code);
201 Expect.isTrue(
202 errors.single.startsWith("'native' modifier is not supported."));
203 Expect.isTrue(warnings.isEmpty);
204 });
186 } 205 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/native/native.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698