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

Unified Diff: pkg/kernel/test/self_check_util.dart

Issue 2549793002: Add 'self_check' runtime for running self-checking unit tests (Closed)
Patch Set: Address comments Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/kernel/test/round_trip_test_disabled.dart ('k') | pkg/kernel/test/verify_self_check.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/test/self_check_util.dart
diff --git a/pkg/kernel/test/self_check_util.dart b/pkg/kernel/test/self_check_util.dart
new file mode 100644
index 0000000000000000000000000000000000000000..81a4c6676d11ca5cc1dcac60882af168ef4f3d49
--- /dev/null
+++ b/pkg/kernel/test/self_check_util.dart
@@ -0,0 +1,34 @@
+// 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.
+
+import '../bin/batch_util.dart';
+import 'dart:async';
+
+/// Wraps a main() method for a test that should be runnable as a self-checking
+/// unit test.
+///
+/// These tests can be run like:
+///
+/// tools/test.py -cdartk -rself_check
+///
+/// The test can either be run with a single file passed on the command line
+/// or run in batch mode.
+runSelfCheck(List<String> args, Future runTest(String filename)) {
+ Future<CompilerOutcome> batchMain(List<String> arguments) async {
+ if (arguments.length != 1) {
+ throw 'Exactly one argument expected';
+ }
+ String filename = arguments[0];
+ if (!filename.endsWith('.dill')) {
+ throw 'File does not have expected .dill extension: $filename';
+ }
+ await runTest(filename);
+ return CompilerOutcome.Ok;
+ }
+ if (args.length == 1 && args[0] == '--batch') {
+ runBatch(batchMain);
+ } else {
+ batchMain(args);
+ }
+}
« no previous file with comments | « pkg/kernel/test/round_trip_test_disabled.dart ('k') | pkg/kernel/test/verify_self_check.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698