| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 /** | 5 /** |
| 6 * A simple unit test library for running tests on the VM. | 6 * A simple unit test library for running tests on the VM. |
| 7 */ | 7 */ |
| 8 library unittest_vm_config; | 8 library unittest_vm_config; |
| 9 | 9 |
| 10 import 'dart:async'; | 10 import 'dart:async'; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 return "${GREEN_COLOR}${result}${NO_COLOR}"; | 31 return "${GREEN_COLOR}${result}${NO_COLOR}"; |
| 32 } else if (testCase.result == FAIL) { | 32 } else if (testCase.result == FAIL) { |
| 33 return "${RED_COLOR}${result}${NO_COLOR}"; | 33 return "${RED_COLOR}${result}${NO_COLOR}"; |
| 34 } else if (testCase.result == ERROR) { | 34 } else if (testCase.result == ERROR) { |
| 35 return "${MAGENTA_COLOR}${result}${NO_COLOR}"; | 35 return "${MAGENTA_COLOR}${result}${NO_COLOR}"; |
| 36 } | 36 } |
| 37 } | 37 } |
| 38 return result; | 38 return result; |
| 39 } | 39 } |
| 40 | 40 |
| 41 void onInit() { |
| 42 super.onInit(); |
| 43 filterStacks = formatStacks = true; |
| 44 } |
| 45 |
| 41 void onDone(bool success) { | 46 void onDone(bool success) { |
| 42 int status; | 47 int status; |
| 43 try { | 48 try { |
| 44 super.onDone(success); | 49 super.onDone(success); |
| 45 status = 0; | 50 status = 0; |
| 46 } catch (ex) { | 51 } catch (ex) { |
| 47 // A non-zero exit code is used by the test infrastructure to detect | 52 // A non-zero exit code is used by the test infrastructure to detect |
| 48 // failure. | 53 // failure. |
| 49 status = 1; | 54 status = 1; |
| 50 } | 55 } |
| 51 Future.wait([stdout.close(), stderr.close()]).then((_) { | 56 Future.wait([stdout.close(), stderr.close()]).then((_) { |
| 52 exit(status); | 57 exit(status); |
| 53 }); | 58 }); |
| 54 } | 59 } |
| 55 } | 60 } |
| 56 | 61 |
| 57 void useVMConfiguration() { | 62 void useVMConfiguration() { |
| 58 unittestConfiguration = _singleton; | 63 unittestConfiguration = _singleton; |
| 59 } | 64 } |
| 60 | 65 |
| 61 final _singleton = new VMConfiguration(); | 66 final _singleton = new VMConfiguration(); |
| OLD | NEW |