Skip to content

Commit

Permalink
Various code cleanups; rename analysis_options
Browse files Browse the repository at this point in the history
* rename analysis_options

* replace deprecated throws matcher

* remove unnecessary cast
  • Loading branch information
a14n authored and cbracken committed Oct 11, 2017
1 parent be80837 commit 227522d
Show file tree
Hide file tree
Showing 12 changed files with 20 additions and 18 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion test/async/concat_test.dart
Expand Up @@ -96,7 +96,7 @@ main() {
var data = [], errors = [];
var badIteration =
['e', 'this should not get thrown'].map((message) => throw message);
var concatenated = concat(badIteration as Iterable<Stream>);
var concatenated = concat(badIteration);
var completer = new Completer();
concatenated.listen(data.add,
onError: errors.add, onDone: completer.complete);
Expand Down
2 changes: 1 addition & 1 deletion test/async/future_group_test.dart
Expand Up @@ -54,7 +54,7 @@ main() {
group.add(completer1.future);
completer1.complete(1);
return new Future(() {
expect(() => group.add(completer2.future), throws);
expect(() => group.add(completer2.future), throwsStateError);
});
});
});
Expand Down
7 changes: 4 additions & 3 deletions test/async/iteration_test.dart
Expand Up @@ -92,12 +92,13 @@ main() {
});

test('should validate maxTasks', () {
expect(() => forEachAsync([], (i) {}, maxTasks: null), throws);
expect(() => forEachAsync([], (i) {}, maxTasks: 0), throws);
expect(
() => forEachAsync([], (i) {}, maxTasks: null), throwsArgumentError);
expect(() => forEachAsync([], (i) {}, maxTasks: 0), throwsArgumentError);
});

test('should validate iterable', () {
expect(() => forEachAsync(null, (i) {}), throws);
expect(() => forEachAsync(null, (i) {}), throwsArgumentError);
});

test('should complete when given no work', () {
Expand Down
5 changes: 3 additions & 2 deletions test/collection/delegates/iterable_test.dart
Expand Up @@ -130,13 +130,14 @@ void main() {
});

test('single', () {
expect(() => delegatingIterable.single, throws);
expect(() => delegatingIterable.single, throwsStateError);
expect(new MyIterable(['a']).single, equals('a'));
});

test('singleWhere', () {
expect(delegatingIterable.singleWhere((e) => e == 'b'), equals('b'));
expect(() => delegatingIterable.singleWhere((e) => e == 'd'), throws);
expect(() => delegatingIterable.singleWhere((e) => e == 'd'),
throwsStateError);
});

test('skip', () {
Expand Down
2 changes: 1 addition & 1 deletion test/collection/delegates/list_test.dart
Expand Up @@ -37,7 +37,7 @@ void main() {
expect(delegatingList[0], equals('a'));
expect(delegatingList[1], equals('b'));
expect(delegatingList[2], equals('cc'));
expect(() => delegatingList[3], throws);
expect(() => delegatingList[3], throwsRangeError);
});

test('[]=', () {
Expand Down
2 changes: 1 addition & 1 deletion test/core/optional_test.dart
Expand Up @@ -21,7 +21,7 @@ main() {
group('Optional', () {
test('absent should be not present and not gettable', () {
expect(new Optional<int>.absent().isPresent, isFalse);
expect(() => new Optional<int>.absent().value, throws);
expect(() => new Optional<int>.absent().value, throwsStateError);
});

test('of should return value', () {
Expand Down
4 changes: 2 additions & 2 deletions test/iterables/concat_test.dart
Expand Up @@ -41,7 +41,7 @@ main() {
});

test('should throw for null input', () {
expect(() => concat(null), throws);
expect(() => concat(null), throwsNoSuchMethodError);
});

test('should throw if any input is null', () {
Expand All @@ -51,7 +51,7 @@ main() {
null,
[3, 4]
]).toList(),
throws);
throwsNoSuchMethodError);
});

test('should reflectchanges in the inputs', () {
Expand Down
2 changes: 1 addition & 1 deletion test/iterables/enumerate_test.dart
Expand Up @@ -56,7 +56,7 @@ main() {
expect(e.single.index, 0);
expect(e.single.value, 'a');

expect(() => enumerate([1, 2]).single, throws);
expect(() => enumerate([1, 2]).single, throwsStateError);
});

test("length", () {
Expand Down
4 changes: 2 additions & 2 deletions test/iterables/merge_test.dart
Expand Up @@ -61,8 +61,8 @@ main() {
test("should throw on null elements", () {
var a = ['a', null, 'c'];
var b = ['a', 'b', 'c'];
expect(() => merge([a, b]).forEach((e) {}), throws);
expect(() => merge([b, a]).forEach((e) {}), throws);
expect(() => merge([a, b]).forEach((e) {}), throwsNoSuchMethodError);
expect(() => merge([b, a]).forEach((e) {}), throwsNoSuchMethodError);
});

test("should handle zig-zag case", () {
Expand Down
4 changes: 2 additions & 2 deletions test/iterables/range_test.dart
Expand Up @@ -47,11 +47,11 @@ main() {
});

test("should throw with a bad range", () {
expect(() => range(10, 0), throws);
expect(() => range(10, 0), throwsArgumentError);
});

test("should throw with a bad step", () {
expect(() => range(0, 10, -1), throws);
expect(() => range(0, 10, -1), throwsArgumentError);
});
});
}
4 changes: 2 additions & 2 deletions test/strings_test.dart
Expand Up @@ -140,10 +140,10 @@ main() {

// Corner cases
test('should throw on null', () {
expect(() => loop(null, 6, 8), throws);
expect(() => loop(null, 6, 8), throwsArgumentError);
});
test('should throw on empty', () {
expect(() => loop('', 6, 8), throws);
expect(() => loop('', 6, 8), throwsArgumentError);
});
});

Expand Down

0 comments on commit 227522d

Please sign in to comment.