cover the cli-install env fallback and stale-GUI activation paths

Adds the two missing cases that left lib/kernel/src/cli_install.dart:74
(default-environment constructor branch) and the builtin extension's
stale-GUI activation warning uncovered.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-06 12:59:48 +02:00
co-authored by Claude Opus 4.8
parent 9bdab1d2d3
commit f63ab521f1
2 changed files with 24 additions and 0 deletions
@@ -69,6 +69,22 @@ void main() {
expect(notes.first.title, 'clide CLI not installed'); expect(notes.first.title, 'clide CLI not installed');
}); });
test('warns on activation when clide is a stale GUI symlink', () async {
final gui = touchExec('${tmp.path}/gui/clide').path;
final binDir = Directory('${tmp.path}/bin')..createSync();
Link('${binDir.path}/clide').createSync(gui); // PATH clide → the GUI
await boot(CliInstaller(
resolvedExecutable: gui,
env: {'PATH': binDir.path},
bundledClientCandidates: const [],
installDir: binDir.path,
));
final notes = f.services.notify.active;
expect(notes, isNotEmpty);
expect(notes.first.level, NotificationLevel.warning);
expect(notes.first.title, 'clide CLI is stale');
});
test('does not warn when clide is already installed', () async { test('does not warn when clide is already installed', () async {
final binDir = Directory('${tmp.path}/bin')..createSync(); final binDir = Directory('${tmp.path}/bin')..createSync();
touchExec('${binDir.path}/clide'); touchExec('${binDir.path}/clide');
+8
View File
@@ -128,6 +128,14 @@ void main() {
); );
expect(i.bundledClientCandidates, ['/opt/clide/bundle/clide-cli']); expect(i.bundledClientCandidates, ['/opt/clide/bundle/clide-cli']);
}); });
test('falls back to the process environment when no env is passed', () {
// No env → uses Platform.environment; the in-bundle candidate still
// derives from the exe dir and the install dir from $HOME.
final i = CliInstaller(resolvedExecutable: '/opt/clide/bundle/clide');
expect(i.bundledClientCandidates, contains('/opt/clide/bundle/clide-cli'));
expect(i.installDir, endsWith('/.local/bin'));
});
}); });
group('expandedPath', () { group('expandedPath', () {