From 710946bcd455c3bd67ceaafd269ccb09030dd531 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sat, 22 Aug 2026 12:07:38 +0000 Subject: [PATCH] test: add unit tests for DisposableBagException.toString Co-authored-by: esenmx <43244505+esenmx@users.noreply.github.com> --- test/disposable_bag_test.dart | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/disposable_bag_test.dart b/test/disposable_bag_test.dart index d7c8b3f..981768b 100644 --- a/test/disposable_bag_test.dart +++ b/test/disposable_bag_test.dart @@ -108,4 +108,30 @@ void main() { check(calls).deepEquals(['a', 'c']); }); }); + + group('DisposableBagException', () { + test('toString formats single error correctly', () { + final exception = DisposableBagException([ + Exception('error 1'), + ]); + + check(exception.toString()).equals( + 'DisposableBagException: 1 disposer(s) threw errors:\n' + ' - Exception: error 1', + ); + }); + + test('toString formats multiple errors correctly', () { + final exception = DisposableBagException([ + Exception('first error'), + 'second error', + ]); + + check(exception.toString()).equals( + 'DisposableBagException: 2 disposer(s) threw errors:\n' + ' - Exception: first error\n' + ' - second error', + ); + }); + }); }