fix: prettyPrint for instance of `Type` is not an instance of the Type
Fixes prettyPrint function and associated test
diff --git a/lib/src/pretty_print.dart b/lib/src/pretty_print.dart
index 4c58f3c..1cbe139 100644
--- a/lib/src/pretty_print.dart
+++ b/lib/src/pretty_print.dart
@@ -107,8 +107,6 @@
object == null ||
defaultToString) {
return value;
- } else if (object is Type) {
- return 'instance of `$object`';
} else {
return "${_typeName(object)}:$value";
}
@@ -127,6 +125,7 @@
// So we play safe here.
try {
if (x == null) return "null";
+ if (x is Type) return "Type";
var type = x.runtimeType.toString();
// TODO(nweiz): if the object's type is private, find a public superclass to
// display once there's a portable API to do that.
diff --git a/test/pretty_print_test.dart b/test/pretty_print_test.dart
index 4872850..7c9c44b 100644
--- a/test/pretty_print_test.dart
+++ b/test/pretty_print_test.dart
@@ -257,7 +257,7 @@
});
test('Type', () {
- expect(prettyPrint(''.runtimeType), 'instance of `String`');
+ expect(prettyPrint(''.runtimeType), 'Type:<String>');
});
}