dart-lang / test

A library for writing unit tests in Dart.
https://pub.dev/packages/test
495 stars 213 forks source link

isInstanceOf should be a method #2375

Open Hixie opened 6 years ago

Hixie commented 6 years ago

@kevmoo @natebosch Based on our meeting today, Flutter is hiding TypeMatcher and isInstanceOf from test in all our tests (and in the flutter_test package that we export to our users), and instead just exporting a function called isInstanceOf. This is ugly and we would prefer if we could just have an isInstanceOf method so that we didn't need to have these hacks.

kevmoo commented 6 years ago

When we're ready to roll a major release of matcher + test, we'll make this change!

Hixie commented 5 years ago

dart-lang/matcher#110 didn't solve this. It used a different name that won't allow us to unfork.

natebosch commented 5 years ago

Will leave open until we can remove isInstanceOf with a breaking change version bump.

natebosch commented 5 years ago

Discussed offline - flutter_test will keep it's own isInstanceOf unless they decide to do a breaking change, or forever, which can be handled independently from anything test. We will not keep isInstanceOf in matcher or test once we have other compelling reasons for a breaking version bump.

jamesderlin commented 5 years ago

I'm not sure what the current intention is, but currently the documentation for isInstanceOf says:

DEPRECATED Use TypeMatcher instead.

but also:

Annotations @Deprecated('Use isA<MyType>() instead.')

which seems inconsistent.

jamesderlin commented 5 years ago

It's also confusing to recommend using TypeMatcher because Flutter has its own copy of the package:matcher docs, but in a Flutter context, package:matcher's TypeMatcher is hidden and TypeMatcher is something different.

kevmoo commented 4 years ago

FYI: Flutter TypeMatcher is now marked as deprecated.

We shipped isA<T>, which can be pointed to by Flutters isInstanceOf function.

Can we close this out?