diff --git a/pkgs/leak_tracker/test/debug/leak_tracking/orchestration_test.dart b/pkgs/leak_tracker/test/debug/leak_tracking/orchestration_test.dart index a528c069..4197d8fe 100644 --- a/pkgs/leak_tracker/test/debug/leak_tracking/orchestration_test.dart +++ b/pkgs/leak_tracker/test/debug/leak_tracking/orchestration_test.dart @@ -5,11 +5,17 @@ import 'package:leak_tracker/leak_tracker.dart'; import 'package:test/test.dart'; +class MyClass { + MyClass(); + + final Stopwatch stopwatch = Stopwatch(); + WeakReference get ref => WeakReference(stopwatch); +} + void main() { + final myObject = MyClass(); test('formattedRetainingPath returns path', () async { - final Object myObject = [1, 2, 3, 4, 5]; - final path = await formattedRetainingPath(WeakReference(myObject)); - - print(path); + final path = await formattedRetainingPath(myObject.ref); + expect(path, contains('_test.dart/MyClass:stopwatch')); }); } diff --git a/pkgs/leak_tracker/test/debug/leak_tracking/retaining_path/_retaining_path_test.dart b/pkgs/leak_tracker/test/debug/leak_tracking/retaining_path/_retaining_path_test.dart index f3d04f5d..62a30e4d 100644 --- a/pkgs/leak_tracker/test/debug/leak_tracking/retaining_path/_retaining_path_test.dart +++ b/pkgs/leak_tracker/test/debug/leak_tracking/retaining_path/_retaining_path_test.dart @@ -39,7 +39,9 @@ void main() { final instance = MyClass(); final path = await obtainRetainingPath( - instance.runtimeType, identityHashCode(instance)); + instance.runtimeType, + identityHashCode(instance), + ); expect(path!.elements, isNotEmpty); });