Pre-Windows-VM hardening — the parts validatable on Linux, leaving the unrunnable FFI (Job Object, T-424) for the VM session: - Clamp PTY cols/rows to >= 2 in both backends' spawn + resize (new pty_size.dart). A 1-column ConPTY makes conhost spin emitting CRLF (microsoft/terminal#19922); 0 is invalid on both platforms. - ci/test.sh: --timeout 60s on the dart-test pty line (matches the flutter lines) so a wedged ConPTY reader fails fast instead of hanging the run. - Make windows_pty.dart's pure helpers public + testable off-Windows: quoteArg (MSVCRT quoting), composeEnvironmentBlock, and resolveExecutable (now takes an injectable existence probe). New windows_pty_args_test.dart + pty_size_test.dart give 15 cross-platform assertions over the trickiest Windows logic the on-Windows smoke suite can't reach off-platform. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
24 lines
806 B
Dart
24 lines
806 B
Dart
/// Unit tests for the shared PTY-dimension clamp (`pty_size.dart`). Both
|
|
/// backends route spawn + resize through it so a degenerate (0/1) terminal
|
|
/// size can never reach a child — see microsoft/terminal#19922.
|
|
library;
|
|
|
|
import 'package:clide/src/pty/pty_size.dart';
|
|
import 'package:test/test.dart';
|
|
|
|
void main() {
|
|
group('clampPtyDimension', () {
|
|
test('raises sub-minimum values to the floor', () {
|
|
expect(clampPtyDimension(0), minPtyDimension);
|
|
expect(clampPtyDimension(1), minPtyDimension);
|
|
expect(clampPtyDimension(-5), minPtyDimension);
|
|
});
|
|
|
|
test('passes through values at or above the floor', () {
|
|
expect(clampPtyDimension(minPtyDimension), minPtyDimension);
|
|
expect(clampPtyDimension(80), 80);
|
|
expect(clampPtyDimension(24), 24);
|
|
});
|
|
});
|
|
}
|