Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address deprecation lints #94

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ dev_dependencies:
coverage: "^0.7.2"
dart_dev: "^1.7.6"
mockito: "^0.11.0"
over_react_test: "^1.0.0"
test: "^0.12.6+2"
over_react_test: "^1.0.1"
test: "^0.12.24"

transformers:
- over_react:
Expand Down
4 changes: 3 additions & 1 deletion test/over_react/component/prop_mixins_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ library prop_mixins_test;
import 'dart:collection' show MapView;

import 'package:over_react/over_react.dart';
import 'package:over_react_test/over_react_test.dart';
import 'package:test/test.dart';

import '../../wsd_test_util/prop_utils.dart';
Expand Down Expand Up @@ -68,7 +69,8 @@ main() {
group('AriaProps', () {
test('cannot set / read values that are not its prop map', () {
var instance = new AriaPropMixinsTest({});
expect(() {instance['notThere'];}, throws);
expect(() {instance['notThere'];},
throwsA(hasToStringValue(contains('Map does not contain this key'))));
});

for (var propKey in const $PropKeys(AriaPropsMixin)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ main() {
});

test('when a single non-invoked builder child is passed in', () {
expect(() => Dom.div()(Dom.div()), throws);
expect(() => Dom.div()(Dom.div()), throwsArgumentError);
verifyValidationWarning(contains('It looks like you are trying to use a non-invoked builder as a child.'));
});

Expand Down Expand Up @@ -158,7 +158,7 @@ main() {
Dom.div(),
Dom.p()(),
Dom.div()
]), throws);
]), throwsArgumentError);
verifyValidationWarning(contains('It looks like you are trying to use a non-invoked builder as a child.'));
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ library over_react.transformer_generation.helpers_test;
import 'package:over_react/src/component_declaration/transformer_helpers.dart';
import 'package:test/test.dart';

const Matcher throwsUngeneratedError = const Throws(const isInstanceOf<UngeneratedError>());
const Matcher throwsIllegalInstantiationError = const Throws(const isInstanceOf<IllegalInstantiationError>());
final Matcher throwsUngeneratedError = throwsA(const isInstanceOf<UngeneratedError>());
final Matcher throwsIllegalInstantiationError = throwsA(const isInstanceOf<IllegalInstantiationError>());

main() {
group('transformation generation helpers:', () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ main() {
test('state class cannot be instantiated directly', () {
expect(() {
new StatefulComponentTestState();
}, throws);
}, throwsA(const isInstanceOf<IllegalInstantiationError>()));
});

test('renders a component from end to end, successfully reading state via typed getters', () {
Expand Down
9 changes: 6 additions & 3 deletions test/over_react/util/handler_chain_util_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ main() {

var chained = callbackUtil.chain(a, b);

expect(() => Function.apply(chained, generateBadTypeArgs()), throws);
expect(() => Function.apply(chained, generateBadTypeArgs()),
throwsA(const isInstanceOf<TypeError>()));
}, testOn: 'dart-vm');
}
});
Expand Down Expand Up @@ -245,7 +246,8 @@ main() {

var chained = callbackUtil.chainFromList(functions);

expect(() => Function.apply(chained, generateBadTypeArgs()), throws);
expect(() => Function.apply(chained, generateBadTypeArgs()),
throwsA(const isInstanceOf<TypeError>()));
}, testOn: 'dart-vm');
}
});
Expand All @@ -257,7 +259,8 @@ main() {

if (arity != 0) {
test('with arguments typed to the specified generic parameters', () {
expect(() => Function.apply(callbackUtil.noop, generateBadTypeArgs()), throws);
expect(() => Function.apply(callbackUtil.noop, generateBadTypeArgs()),
throwsA(const isInstanceOf<TypeError>()));
}, testOn: 'dart-vm');
}
});
Expand Down
8 changes: 5 additions & 3 deletions test/wsd_test_util/prop_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,22 @@ library test_util.prop_utils;
])
import 'dart:mirrors';

import 'package:over_react_test/over_react_test.dart';
import 'package:test/test.dart';

void testProp (Symbol name, dynamic expectedKey, instance, testValue) {
void testProp(Symbol name, dynamic expectedKey, instance, testValue) {
InstanceMirror mirror = reflect(instance);

mirror.setField(name, testValue);
expect(instance[expectedKey], equals(testValue));
expect(mirror.getField(name).reflectee, equals(testValue));
}

void testKeys (List<String> keys, dynamic instanceBuilder()) {
void testKeys(List<String> keys, dynamic instanceBuilder()) {
test('cannot set / read values that are not its prop map', () {
var instance = instanceBuilder();
expect(() {instance['notThere'];}, throws);
expect(() {instance['notThere'];},
throwsA(hasToStringValue(contains('Map does not contain this key'))));
});
for (var propKey in keys) {
test('prop: $propKey can have its value set / read', () {
Expand Down
7 changes: 3 additions & 4 deletions test/wsd_test_util/zone.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,13 @@ void storeZone([Zone zone]) {
_zone = zone;
}

/// Calls [expect] in package:test/test.dart in the zone stored in [setZone].
/// Calls [expect] in package:test/test.dart in the zone stored in [storeZone].
///
/// Useful for expectations in blocks called in other zones.
void zonedExpect(actual, matcher,
{String reason, bool verbose: false, ErrorFormatter formatter}) {
void zonedExpect(actual, matcher, {String reason}) {
validateZone();

return _zone.run(() {
expect(actual, matcher, verbose: verbose, formatter: formatter);
expect(actual, matcher);
});
}