| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 /// This is a utility to run and debug an individual DDC compiled test. | 5 /// This is a utility to run and debug an individual DDC compiled test. |
| 6 /// Tests can be run with either node or devtool (a Chrome-based utility with | 6 /// Tests can be run with either node or devtool (a Chrome-based utility with |
| 7 /// DOM APIs and developer tools support). | 7 /// DOM APIs and developer tools support). |
| 8 /// | 8 /// |
| 9 /// Install devtool via: | 9 /// Install devtool via: |
| 10 /// > npm install -g devtool | 10 /// > npm install -g devtool |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 } | 55 } |
| 56 if (e) { | 56 if (e) { |
| 57 console.log('Test ' + test + ' failed:\n' + e.toString()); | 57 console.log('Test ' + test + ' failed:\n' + e.toString()); |
| 58 sdk.dart.stackPrint(e); | 58 sdk.dart.stackPrint(e); |
| 59 } else { | 59 } else { |
| 60 console.log('Test ' + test + ' passed.'); | 60 console.log('Test ' + test + ' passed.'); |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 sdk.dart.ignoreWhitelistedErrors(false); | 64 sdk.dart.ignoreWhitelistedErrors(false); |
| 65 sdk.dart.failForWeakModeIsChecks(false); | |
| 66 sdk._isolate_helper.startRootIsolate(() => {}, []); | 65 sdk._isolate_helper.startRootIsolate(() => {}, []); |
| 67 // Make it easier to debug test failures and required for formatter test that | 66 // Make it easier to debug test failures and required for formatter test that |
| 68 // assumes custom formatters are enabled. | 67 // assumes custom formatters are enabled. |
| 69 sdk._debugger.registerDevtoolsFormatter(); | 68 sdk._debugger.registerDevtoolsFormatter(); |
| 70 | 69 |
| 71 var async_helper = requirejs('async_helper').async_helper; | 70 var async_helper = requirejs('async_helper').async_helper; |
| 72 async_helper.asyncTestInitialize(finish); | 71 async_helper.asyncTestInitialize(finish); |
| 73 | 72 |
| 74 var module = requirejs(test); | 73 var module = requirejs(test); |
| 75 var lib = test.split('/').slice(-1)[0]; | 74 var lib = test.split('/').slice(-1)[0]; |
| 76 try { | 75 try { |
| 77 if (module[lib]._expectRuntimeError) negative = true; | 76 if (module[lib]._expectRuntimeError) negative = true; |
| 78 var result = module[lib].main(); | 77 var result = module[lib].main(); |
| 79 // async_helper tests call finish directly - call here for all other | 78 // async_helper tests call finish directly - call here for all other |
| 80 // tests. | 79 // tests. |
| 81 if (!async_helper.asyncTestStarted) { | 80 if (!async_helper.asyncTestStarted) { |
| 82 if (!result || !(sdk.async.Future.is(result))) { | 81 if (!result || !(sdk.async.Future.is(result))) { |
| 83 finish(); | 82 finish(); |
| 84 } else { | 83 } else { |
| 85 // Wait iff result is a future | 84 // Wait iff result is a future |
| 86 result.then(sdk.dart.dynamic)(() => finish(), { onError: (e) => finish(e)
}); | 85 result.then(sdk.dart.dynamic)(() => finish(), { onError: (e) => finish(e)
}); |
| 87 } | 86 } |
| 88 } | 87 } |
| 89 } catch (e) { | 88 } catch (e) { |
| 90 finish(e); | 89 finish(e); |
| 91 } | 90 } |
| OLD | NEW |