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

Side by Side Diff: pkg/unittest/lib/html_individual_config.dart

Issue 12729026: fix variable in catch statement (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: while I'm at it Created 7 years, 9 months 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 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 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 unit test library for running groups of tests in a browser, instead of the 6 * A unit test library for running groups of tests in a browser, instead of the
7 * entire test file. This is especially used for large tests files that have 7 * entire test file. This is especially used for large tests files that have
8 * many subtests, so we can mark groups as failing at a finer granularity than 8 * many subtests, so we can mark groups as failing at a finer granularity than
9 * the entire test file. 9 * the entire test file.
10 * 10 *
11 * To use, import this file, and call [useHtmlIndividualConfiguration] at the 11 * To use, import this file, and call [useHtmlIndividualConfiguration] at the
12 * start of your set sequence. Important constraint: your group descriptions 12 * start of your set sequence. Important constraint: your group descriptions
13 * MUST NOT contain spaces. 13 * MUST NOT contain spaces.
14 */ 14 */
15 library unittest_html_individual_config; 15 library unittest_html_individual_config;
16 16
17 import 'dart:html'; 17 import 'dart:html';
18 import 'unittest.dart' as unittest; 18 import 'unittest.dart' as unittest;
19 import 'html_config.dart' as htmlconfig; 19 import 'html_config.dart' as htmlconfig;
20 20
21 class HtmlIndividualConfiguration extends htmlconfig.HtmlConfiguration { 21 class HtmlIndividualConfiguration extends htmlconfig.HtmlConfiguration {
22 22 HtmlIndividualConfiguration(bool isLayoutTest): super(isLayoutTest);
23 String _noSuchTest = '';
24 HtmlIndividualConfiguration(isLayoutTest): super(isLayoutTest);
25 23
26 void onStart() { 24 void onStart() {
27 var search = window.location.search; 25 var search = window.location.search;
28 if (search != '') { 26 if (search != '') {
29 try { 27 try {
30 for (var parameter in search.substring(1).split('&')) { 28 for (var parameter in search.substring(1).split('&')) {
31 if (parameter.startsWith('group=')) { 29 if (parameter.startsWith('group=')) {
32 var testGroupName = parameter.split('=')[1]; 30 var testGroupName = parameter.split('=')[1];
Siggi Cherem (dart-lang) 2013/03/22 21:08:17 would you mind instead pulling out the testGroupNa
Emily Fortuna 2013/03/22 22:05:51 The previous refactor is strange. I think what you
33 unittest.filterTests('^$testGroupName${unittest.groupSep}'); 31 unittest.filterTests('^$testGroupName${unittest.groupSep}');
34 } 32 }
35 } 33 }
36 } catch (e) { 34 } catch (e) {
37 print('tried to match "$testGroupName"'); 35 print('tried to match "$search"');
38 print('NO_SUCH_TEST'); 36 print('NO_SUCH_TEST');
39 } 37 }
40 } 38 }
41 super.onStart(); 39 super.onStart();
42 } 40 }
43 } 41 }
44 42
45 void useHtmlIndividualConfiguration([bool isLayoutTest = false]) { 43 void useHtmlIndividualConfiguration([bool isLayoutTest = false]) {
46 if (unittest.config != null) return; 44 if (unittest.config != null) return;
47 unittest.configure(new HtmlIndividualConfiguration(isLayoutTest)); 45 unittest.configure(new HtmlIndividualConfiguration(isLayoutTest));
48 } 46 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698