Skip to content

Commit

Permalink
Enable group names containing spaces in HtmlIndividualConfiguration
Browse files Browse the repository at this point in the history
Fixes test issue #61

BUG= http://dartbug.com/23156
R=nweiz@google.com

Review URL: https://codereview.chromium.org//1128383002
  • Loading branch information
kevmoo committed May 7, 2015
1 parent aba274a commit e11f429
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
##0.11.6

* Fix running individual tests with `HtmlIndividualConfiguration` when the test
name contains URI-escaped values and is provided with the `group` query
parameter.

##0.11.5+4

* Improved the output of `TestCase` failures in `HtmlConfig`.
Expand Down
32 changes: 14 additions & 18 deletions lib/html_individual_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,20 @@ class HtmlIndividualConfiguration extends htmlconfig.HtmlConfiguration {
HtmlIndividualConfiguration(bool isLayoutTest) : super(isLayoutTest);

void onStart() {
var search = window.location.search;
if (search != '') {
var groups = search
.substring(1)
.split('&')
.where((p) => p.startsWith('group='))
.toList();

if (!groups.isEmpty) {
if (groups.length > 1) {
throw new ArgumentError('More than one "group" parameter provided.');
}

var testGroupName = groups.single.split('=')[1];
var startsWith = "$testGroupName${unittest.groupSep}";
unittest.filterTests(
(unittest.TestCase tc) => tc.description.startsWith(startsWith));
}
var uri = Uri.parse(window.location.href);

var groups = 'group='.allMatches(uri.query).toList();

if (groups.length > 1) {
throw new ArgumentError('More than one "group" parameter provided.');
}

var testGroupName = uri.queryParameters['group'];

if (testGroupName != null) {
var startsWith = "$testGroupName${unittest.groupSep}";
unittest.filterTests(
(unittest.TestCase tc) => tc.description.startsWith(startsWith));
}
super.onStart();
}
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: unittest
version: 0.11.5+4
version: 0.11.6-dev
author: Dart Team <misc@dartlang.org>
description: A library for writing dart unit tests.
homepage: https://github.com/dart-lang/unittest
homepage: https://github.com/dart-lang/old_unittest
environment:
sdk: '>=1.0.0 <2.0.0'
dependencies:
Expand Down

0 comments on commit e11f429

Please sign in to comment.