test sweep: cover base/disposable.dart (T-91)
test / unit + widget + golden + a11y (push) Failing after 31s
test / integration_test (xvfb) (push) Has been skipped
test / bundle smoke (xvfb 5s) (push) Has been skipped
test / daemon subprocess + web WASM smoke (push) Has been skipped
test / dart doc (lib API) (push) Failing after 1m4s
test / unit + widget + golden + a11y (push) Failing after 31s
test / integration_test (xvfb) (push) Has been skipped
test / bundle smoke (xvfb 5s) (push) Has been skipped
test / daemon subprocess + web WASM smoke (push) Has been skipped
test / dart doc (lib API) (push) Failing after 1m4s
Three pure-Dart tests covering the Disposable mixin: the disposed getter flipping after dispose(), onDisposed firing once, and register propagating dispose to child disposables. Coverage: disposable.dart 12/17 -> 17/17. Total 71.20% -> 71.23%. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
/// Unit tests for `lib/src/terminal/src/base/disposable.dart` —
|
||||
/// covers the `disposed` flag, the `onDisposed` event, and registering
|
||||
/// child disposables.
|
||||
library;
|
||||
|
||||
import 'package:clide/src/terminal/src/base/disposable.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
class _D with Disposable {}
|
||||
|
||||
void main() {
|
||||
group('Disposable mixin', () {
|
||||
test('disposed flips from false to true after dispose()', () {
|
||||
final d = _D();
|
||||
expect(d.disposed, isFalse);
|
||||
d.dispose();
|
||||
expect(d.disposed, isTrue);
|
||||
});
|
||||
|
||||
test('onDisposed fires once when dispose() runs', () {
|
||||
final d = _D();
|
||||
var fired = 0;
|
||||
d.onDisposed((_) => fired++);
|
||||
d.dispose();
|
||||
expect(fired, 1);
|
||||
});
|
||||
|
||||
test('register propagates dispose to child disposables', () {
|
||||
final parent = _D();
|
||||
final child = _D();
|
||||
parent.register(child);
|
||||
expect(child.disposed, isFalse);
|
||||
parent.dispose();
|
||||
expect(child.disposed, isTrue);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user