Files
sdk/pkg/compiler/test/end_to_end/all_native_test.dart
T
Sigmund Cherem 912005267d [web] rename suite dart2js -> web.
Change-Id: I46be49b2effec3e38a3dc44cd45cfe736f77fa78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182680
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-02-04 23:11:32 +00:00

46 lines
1.4 KiB
Dart

// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
// @dart = 2.7
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/commandline_options.dart';
import 'package:expect/expect.dart';
import '../helpers/memory_compiler.dart';
main() {
asyncTest(() async {
print('--test from kernel------------------------------------------------');
await test([]);
});
}
test(List<String> options) async {
DiagnosticCollector collector = new DiagnosticCollector();
String fileName = 'sdk/tests/web_2/native/main.dart';
Uri entryPoint = Uri.parse('memory:$fileName');
await runCompiler(
entryPoint: entryPoint,
memorySourceFiles: {
fileName: '''
import 'dart:html';
import 'dart:_js_helper';
method(o) native;
main() {
method(document);
}
'''
},
diagnosticHandler: collector,
options: [Flags.verbose]..addAll(options));
int allNativeUsedCount =
collector.verboseInfos.where((CollectedMessage message) {
return message.text.startsWith('All native types marked as used due to ');
}).length;
Expect.equals(
1, allNativeUsedCount, "Unexpected message count: $allNativeUsedCount");
}