Raise the declared minimums in pubspec.yaml to what our deps already require: Flutter >=3.35.0 / Dart >=3.9.0 (was 3.19.0 / 3.5.0). alchemist 0.12 needs Flutter 3.32; Dart 3.9 first ships in Flutter 3.35, so 3.35 is the binding floor. Pin the exact build toolchain in .fvmrc (Flutter 3.44.1). Moving to the Dart 3.9 language level switches `dart format` to the new "tall" style and enables two new lints. This commit is the resulting mechanical churn, isolated from any behaviour change: - whole-tree `dart format` reformat (tall style) - `dart fix` for unnecessary_underscores + use_null_aware_elements No runtime behaviour change; `make test` green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
69 lines
2.4 KiB
Dart
69 lines
2.4 KiB
Dart
/// Unit tests for `lib/src/pty/env.dart` and
|
|
/// `lib/src/pty/errors.dart`.
|
|
library;
|
|
|
|
import 'dart:io';
|
|
|
|
import 'package:clide/src/pty/env.dart';
|
|
import 'package:clide/src/pty/errors.dart';
|
|
import 'package:test/test.dart';
|
|
|
|
void main() {
|
|
group('PtyException', () {
|
|
test('toString includes the op + message', () {
|
|
const e = PtyException('posix_spawn', 'kaboom');
|
|
expect(e.toString(), contains('posix_spawn'));
|
|
expect(e.toString(), contains('kaboom'));
|
|
expect(e.toString(), isNot(contains('errno=')));
|
|
});
|
|
|
|
test('toString embeds errno when present', () {
|
|
const e = PtyException('execve', 'no such file', errno: 2);
|
|
expect(e.toString(), contains('errno=2'));
|
|
});
|
|
});
|
|
|
|
group('expandedPath', () {
|
|
test('returns a non-empty string on every platform', () {
|
|
expect(expandedPath, isNotEmpty);
|
|
});
|
|
|
|
test('on Linux/Windows, equals Platform.environment[PATH]', () {
|
|
if (Platform.isMacOS) return; // macOS path-merge tested separately.
|
|
expect(expandedPath, Platform.environment['PATH']);
|
|
});
|
|
|
|
test('on macOS, includes the well-known extras', () {
|
|
if (!Platform.isMacOS) return;
|
|
// Homebrew is the canonical one; at least one of these should appear.
|
|
expect(expandedPath, anyOf(contains('/opt/homebrew/bin'), contains('/usr/local/bin')));
|
|
});
|
|
});
|
|
|
|
group('mergePtyEnv', () {
|
|
test('clide defaults override the process env where they overlap', () {
|
|
final merged = mergePtyEnv(processEnv: {'TERM': 'dumb', 'CUSTOM': 'preserved'});
|
|
expect(merged['TERM'], 'xterm-256color'); // clide default wins
|
|
expect(merged['COLORTERM'], 'truecolor');
|
|
expect(merged['CUSTOM'], 'preserved'); // process env retained
|
|
});
|
|
|
|
test('overrides win over both process env and clide defaults', () {
|
|
final merged = mergePtyEnv(processEnv: {'TERM': 'dumb'}, overrides: {'TERM': 'screen-256color'});
|
|
expect(merged['TERM'], 'screen-256color');
|
|
});
|
|
|
|
test('no overrides argument is equivalent to overrides = null', () {
|
|
final a = mergePtyEnv(processEnv: const {'X': '1'});
|
|
final b = mergePtyEnv(processEnv: const {'X': '1'}, overrides: null);
|
|
expect(a, b);
|
|
});
|
|
|
|
test('clidePtyEnvDefaults set the expected truecolour keys', () {
|
|
expect(clidePtyEnvDefaults['TERM'], 'xterm-256color');
|
|
expect(clidePtyEnvDefaults['COLORTERM'], 'truecolor');
|
|
expect(clidePtyEnvDefaults['CLICOLOR_FORCE'], '1');
|
|
});
|
|
});
|
|
}
|