From c5a7bd878e3d6cd89e33c9c24c465420df2258c1 Mon Sep 17 00:00:00 2001 From: Hossein Yousefi Date: Thu, 12 Dec 2024 03:26:11 +0100 Subject: [PATCH] Clean up for next tests --- .../simple_package_test/runtime_test_registrant.dart | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/jnigen/test/simple_package_test/runtime_test_registrant.dart b/pkgs/jnigen/test/simple_package_test/runtime_test_registrant.dart index 31a63ca63..15968c6a6 100644 --- a/pkgs/jnigen/test/simple_package_test/runtime_test_registrant.dart +++ b/pkgs/jnigen/test/simple_package_test/runtime_test_registrant.dart @@ -745,7 +745,7 @@ void registerTests(String groupName, TestRunnerCallback test) { } }); } - test('Object methods work', () { + test('Object methods work', () async { final runnable = MyRunnable.implement($MyRunnable( run: () {}, )); @@ -753,6 +753,15 @@ void registerTests(String groupName, TestRunnerCallback test) { expect(runnable != runnable, false); expect(runnable.hashCode, runnable.hashCode); expect(runnable.toString(), runnable.toString()); + expect(MyRunnable.$impls, hasLength(1)); + runnable.release(); + if (!Platform.isAndroid) { + // Running garbage collection does not work on Android. Skipping + // this test for android. + _runJavaGC(); + await _waitUntil(() => MyInterface.$impls.isEmpty); + expect(MyRunnable.$impls, isEmpty); + } runnable.release(); }); }