Index: pkg/dev_compiler/tool/run.js |
diff --git a/pkg/dev_compiler/tool/run.js b/pkg/dev_compiler/tool/run.js |
index b27a007f4997afcdf635bf8b87b3b58c706595d7..73069643c073d516023090b6e3f401359624efd2 100644 |
--- a/pkg/dev_compiler/tool/run.js |
+++ b/pkg/dev_compiler/tool/run.js |
@@ -2,9 +2,23 @@ |
// 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. |
+/// This is a utility to run and debug an individual DDC compiled test. |
+/// Tests can be run with either node or devtool (a Chrome-based utility with |
+/// DOM APIs and developer tools support). |
+/// |
+/// Install devtool via: |
+/// > npm install -g devtool |
+/// |
+/// Run via: |
+/// > devtool tool/run.js -- corelib/apply2_test |
+/// or |
+/// > node tool/run.js corelib/apply2_test |
+/// |
+/// See TODO below on async / unittest support. |
+ |
var args = process.argv.slice(2); |
if (args.length != 1) { |
- throw new Error("Usage: node test/run.js <test-module-name>"); |
+ throw new Error("Usage: devtool tool/run.js <test-module-name>"); |
} |
var test = args[0]; |
@@ -27,7 +41,13 @@ requirejs.config({ |
// TODO(vsm): Factor out test framework code in test/browser/language_tests.js |
// and use here. Async tests and unittests won't work without it. |
- |
+var sdk = requirejs('dart_sdk'); |
var module = requirejs(test); |
-test = test.split('/').slice(-1)[0]; |
-module[test].main(); |
+var lib = test.split('/').slice(-1)[0]; |
+try { |
+ module[lib].main(); |
+ console.log('Test ' + test + ' passed.'); |
+} catch (e) { |
+ console.log('Test ' + test + ' failed:\n' + e.toString()); |
+ sdk.dart.stackPrint(e); |
+} |