| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 |
| 5 /** |
| 6 * A unit test library for running subtests one at a time in a browser, |
| 7 * especially used for large tests files that have many subtests, so we can mark |
| 8 * subtests as failing at a finer granularity than the entire test file. |
| 9 * |
| 10 * To use, import this file, and call [useHtmlIndividualConfiguration] at the |
| 11 * start of your set sequence. |
| 12 */ |
| 13 #library('unittest'); |
| 14 |
| 15 #import('unittest.dart', prefix: 'unittest_file'); |
| 16 #import('html_config.dart', prefix: 'htmlconfig'); |
| 17 #import('dart:html'); |
| 18 |
| 19 class HtmlIndividualConfiguration extends htmlconfig.HtmlConfiguration { |
| 20 |
| 21 String _noSuchTest = ''; |
| 22 HtmlIndividualConfiguration(isLayoutTest): super(isLayoutTest); |
| 23 |
| 24 void onStart() { |
| 25 var testName = window.location.hash; |
| 26 if (testName != '') { |
| 27 try { |
| 28 testName = testName.substring(1); // cut off the # |
| 29 unittest_file.filterTests('$testName\$'); |
| 30 } catch (e) { |
| 31 print('tried to match "$testName"'); |
| 32 for (TestCase c in unittest_file.testCases) |
| 33 print('test case ${c.description}'); |
| 34 print('NO_SUCH_TEST'); |
| 35 exit(1); |
| 36 } |
| 37 } |
| 38 super.onStart(); |
| 39 } |
| 40 } |
| 41 |
| 42 void useHtmlIndividualConfiguration([bool isLayoutTest = false]) { |
| 43 unittest_file.configure(new HtmlIndividualConfiguration(isLayoutTest)); |
| 44 } |
| OLD | NEW |