dart format whole tree

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-05-03 21:51:59 +02:00
co-authored by Claude
parent c436e72c5c
commit 9c7ec008dc
102 changed files with 1176 additions and 1282 deletions
+22 -9
View File
@@ -44,8 +44,7 @@ void main() {
if (sandbox.existsSync()) sandbox.deleteSync(recursive: true);
});
Future<IpcResponse> call(String cmd,
[Map<String, Object?> args = const {}]) {
Future<IpcResponse> call(String cmd, [Map<String, Object?> args = const {}]) {
return dispatcher.dispatch(IpcRequest(id: '1', cmd: cmd, args: args));
}
@@ -66,7 +65,9 @@ void main() {
test('git.stage + git.status shows staged file', () async {
await File('${sandbox.path}/new.txt').writeAsString('x');
final stage = await call('git.stage', {'paths': ['new.txt']});
final stage = await call('git.stage', {
'paths': ['new.txt']
});
expect(stage.ok, isTrue);
final r = await call('git.status');
@@ -82,8 +83,12 @@ void main() {
test('git.unstage removes from staging', () async {
await File('${sandbox.path}/new.txt').writeAsString('x');
await call('git.stage', {'paths': ['new.txt']});
final unstage = await call('git.unstage', {'paths': ['new.txt']});
await call('git.stage', {
'paths': ['new.txt']
});
final unstage = await call('git.unstage', {
'paths': ['new.txt']
});
expect(unstage.ok, isTrue);
final r = await call('git.status');
@@ -93,7 +98,9 @@ void main() {
test('git.commit creates a commit', () async {
await File('${sandbox.path}/c.txt').writeAsString('x');
await call('git.stage', {'paths': ['c.txt']});
await call('git.stage', {
'paths': ['c.txt']
});
final r = await call('git.commit', {'message': 'test commit'});
expect(r.ok, isTrue);
expect(r.data['hash'], hasLength(40));
@@ -115,7 +122,9 @@ void main() {
test('git.diff --staged returns staged diffs', () async {
await File('${sandbox.path}/file.txt').writeAsString('modified\n');
await call('git.stage', {'paths': ['file.txt']});
await call('git.stage', {
'paths': ['file.txt']
});
final r = await call('git.diff', {'staged': true});
expect(r.ok, isTrue);
final diffs = r.data['diffs'] as List;
@@ -131,7 +140,9 @@ void main() {
test('git.discard restores a file', () async {
await File('${sandbox.path}/file.txt').writeAsString('changed');
final r = await call('git.discard', {'paths': ['file.txt']});
final r = await call('git.discard', {
'paths': ['file.txt']
});
expect(r.ok, isTrue);
final content = await File('${sandbox.path}/file.txt').readAsString();
expect(content, 'hello\n');
@@ -145,7 +156,9 @@ void main() {
test('mutations emit git.changed events', () async {
await File('${sandbox.path}/e.txt').writeAsString('x');
await call('git.stage', {'paths': ['e.txt']});
await call('git.stage', {
'paths': ['e.txt']
});
expect(
sink.events,
contains(predicate<IpcEvent>((e) => e.kind == 'git.changed')),
+3 -13
View File
@@ -71,19 +71,14 @@ void main() {
}
final lines = <String>[];
final done = Completer<void>();
final sub = socket
.cast<List<int>>()
.transform(utf8.decoder)
.transform(const LineSplitter())
.listen((line) {
final sub = socket.cast<List<int>>().transform(utf8.decoder).transform(const LineSplitter()).listen((line) {
lines.add(line);
if (lines.length == 5) done.complete();
});
await done.future.timeout(const Duration(seconds: 2));
await sub.cancel();
await socket.close();
final ids =
lines.map((l) => (IpcMessage.decode(l) as IpcResponse).id).toSet();
final ids = lines.map((l) => (IpcMessage.decode(l) as IpcResponse).id).toSet();
expect(ids, {'0', '1', '2', '3', '4'});
});
@@ -112,12 +107,7 @@ Future<String> _send(String socketPath, String line) async {
0,
);
socket.writeln(line);
final resp = await socket
.cast<List<int>>()
.transform(utf8.decoder)
.transform(const LineSplitter())
.first
.timeout(const Duration(seconds: 2));
final resp = await socket.cast<List<int>>().transform(utf8.decoder).transform(const LineSplitter()).first.timeout(const Duration(seconds: 2));
await socket.close();
return resp;
}
+4 -14
View File
@@ -15,8 +15,7 @@ void main() {
group('bin/clide --daemon (subprocess)', () {
setUpAll(() {
if (!binary.existsSync()) {
markTestSkipped(
'bin/clide not built; run `make build` first to enable this suite');
markTestSkipped('bin/clide not built; run `make build` first to enable this suite');
}
});
@@ -41,10 +40,7 @@ void main() {
// Wait for "listening on ..." on stderr before connecting.
final ready = Completer<void>();
final stderrLines = <String>[];
final sub = process.stderr
.transform(utf8.decoder)
.transform(const LineSplitter())
.listen((line) {
final sub = process.stderr.transform(utf8.decoder).transform(const LineSplitter()).listen((line) {
stderrLines.add(line);
if (line.contains('listening')) ready.complete();
});
@@ -58,12 +54,7 @@ void main() {
0,
).timeout(const Duration(seconds: 3));
sock.writeln(IpcRequest(id: '1', cmd: 'ping').encode());
final line = await sock
.cast<List<int>>()
.transform(utf8.decoder)
.transform(const LineSplitter())
.first
.timeout(const Duration(seconds: 3));
final line = await sock.cast<List<int>>().transform(utf8.decoder).transform(const LineSplitter()).first.timeout(const Duration(seconds: 3));
await sock.close();
final resp = IpcMessage.decode(line) as IpcResponse;
expect(resp.ok, true);
@@ -71,8 +62,7 @@ void main() {
// Clean shutdown
process.kill(ProcessSignal.sigterm);
final exitCode =
await process.exitCode.timeout(const Duration(seconds: 3));
final exitCode = await process.exitCode.timeout(const Duration(seconds: 3));
expect(exitCode, 0);
// Socket file should be unlinked