Skip to content

πŸ§ͺ test: add edge case tests for AsyncButton controller disposal - #16

Merged
esenmx merged 2 commits into
mainfrom
test/internal-controller-disposal-11667479156420786077
Aug 23, 2026
Merged

πŸ§ͺ test: add edge case tests for AsyncButton controller disposal#16
esenmx merged 2 commits into
mainfrom
test/internal-controller-disposal-11667479156420786077

Conversation

@esenmx

@esenmx esenmx commented Aug 22, 2026

Copy link
Copy Markdown
Owner

🎯 What: The testing gap addressed: Missing test cases for internal controller disposal vs external controller non-disposal in AsyncButton.

πŸ“Š Coverage:

  • Unmounting an AsyncButton with an internal controller disposes the controller.
  • Unmounting an AsyncButton with an external controller preserves the controller without disposing it.
  • Swapping external controllers preserves former external controllers.

✨ Result: The improvement in test coverage guarantees proper lifecycle handling and prevents memory leaks or premature controller disposal.


PR created automatically by Jules for task 11667479156420786077 started by @esenmx

@google-labs-jules

Copy link
Copy Markdown
Contributor

πŸ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a πŸ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

google-labs-jules Bot and others added 2 commits August 23, 2026 16:56
Co-authored-by: esenmx <43244505+esenmx@users.noreply.github.com>
Add `mountedController(tester)` and `isDisposed()` / `isNotDisposed()`
checks (via `ChangeNotifier.debugAssertNotDisposed`) to test/_helpers.dart
and use them everywhere instead of an `addListener` probe plus a
`_SpyController` subclass.

The existing test 'swapping from internal to external controller disposes
internal and uses new' never asserted disposal on base β€” deleting the
didUpdateWidget dispose branch survived the whole suite. It now captures
the internal controller and asserts `isDisposed()`, making its name true.

The redundant 'swapping external controllers does not dispose former
external controller' test is folded into the existing a->b swap test as
two explicit `isNotDisposed()` assertions, so a regression fails at an
assertion rather than in `newController()`'s teardown double-dispose.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@esenmx
esenmx force-pushed the test/internal-controller-disposal-11667479156420786077 branch from 9db61a5 to bd4004f Compare August 23, 2026 13:58
@esenmx
esenmx merged commit 5efff50 into main Aug 23, 2026
6 checks passed
@esenmx
esenmx deleted the test/internal-controller-disposal-11667479156420786077 branch August 23, 2026 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant