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>
60 lines
2.3 KiB
Dart
60 lines
2.3 KiB
Dart
/// Tests for `walkFiles` — the recursive, ignore-pruned, capped
|
|
/// workspace file walk behind `files.walk` and the search engine.
|
|
library;
|
|
|
|
import 'dart:io';
|
|
|
|
import 'package:clide/src/files/ignore.dart';
|
|
import 'package:clide/src/files/listing.dart';
|
|
import 'package:test/test.dart';
|
|
|
|
void main() {
|
|
late Directory root;
|
|
|
|
setUp(() async {
|
|
root = await Directory.systemTemp.createTemp('clide-walk-');
|
|
File('${root.path}/README.md').writeAsStringSync('a');
|
|
File('${root.path}/pubspec.yaml').writeAsStringSync('b');
|
|
Directory('${root.path}/lib/src').createSync(recursive: true);
|
|
File('${root.path}/lib/main.dart').writeAsStringSync('c');
|
|
File('${root.path}/lib/src/util.dart').writeAsStringSync('d');
|
|
Directory('${root.path}/build').createSync();
|
|
File('${root.path}/build/output.bin').writeAsStringSync('e');
|
|
});
|
|
tearDown(() async {
|
|
if (root.existsSync()) root.deleteSync(recursive: true);
|
|
});
|
|
|
|
test('walks recursively, returns files sorted by path', () async {
|
|
final r = await walkFiles(root: root, ignore: IgnoreSet([]));
|
|
expect(r.truncated, isFalse);
|
|
expect(r.files.map((e) => e.path).toList(), ['README.md', 'build/output.bin', 'lib/main.dart', 'lib/src/util.dart', 'pubspec.yaml']);
|
|
});
|
|
|
|
test('prunes ignored directories (build/ via builtin ignore)', () async {
|
|
final r = await walkFiles(root: root, ignore: IgnoreSet.builtin());
|
|
final paths = r.files.map((e) => e.path).toList();
|
|
expect(paths, isNot(contains('build/output.bin')));
|
|
expect(paths, containsAll(['README.md', 'lib/main.dart', 'lib/src/util.dart']));
|
|
});
|
|
|
|
test('emits only files, never directory entries', () async {
|
|
final r = await walkFiles(root: root, ignore: IgnoreSet([]));
|
|
expect(r.files.every((e) => !e.isDirectory), isTrue);
|
|
});
|
|
|
|
test('respects the maxFiles cap and flags truncation', () async {
|
|
final r = await walkFiles(root: root, ignore: IgnoreSet([]), maxFiles: 2);
|
|
expect(r.truncated, isTrue);
|
|
expect(r.files, hasLength(2));
|
|
});
|
|
|
|
test('an empty workspace yields no files and is not truncated', () async {
|
|
final empty = await Directory.systemTemp.createTemp('clide-walk-empty-');
|
|
addTearDown(() => empty.deleteSync(recursive: true));
|
|
final r = await walkFiles(root: empty, ignore: IgnoreSet([]));
|
|
expect(r.files, isEmpty);
|
|
expect(r.truncated, isFalse);
|
|
});
|
|
}
|