From 02a79839da93e2ca34bb05a97ca942affb28d2cf Mon Sep 17 00:00:00 2001 From: RyuJongJin <266630912+RyuJongJin@users.noreply.github.com> Date: Sun, 18 Oct 2026 04:11:01 +0900 Subject: [PATCH] =?UTF-8?q?WIP=20=EC=8B=9C=ED=97=98=20=ED=9D=94=EB=93=A4?= =?UTF-8?q?=EB=A6=BC:=20folder=5Fsize=5Ftest=20"=ED=99=94=EB=A9=B4?= =?UTF-8?q?=EC=97=90=EC=84=9C=20=EC=82=AC=EB=9D=BC=EC=A7=84=20=ED=8F=B4?= =?UTF-8?q?=EB=8D=94"=20-=20=EC=A1=B0=EA=B1=B4=EC=9D=B4=20=EB=90=A0=20?= =?UTF-8?q?=EB=95=8C=EA=B9=8C=EC=A7=80=20=EC=8B=A4=EC=A0=9C=20=EC=8B=9C?= =?UTF-8?q?=EA=B0=84=EC=9C=BC=EB=A1=9C=20=EA=B8=B0=EB=8B=A4=EB=A6=AC?= =?UTF-8?q?=EA=B8=B0=20=C2=B7=20=ED=95=9C=EB=8F=84=202=EB=B6=84=20(?= =?UTF-8?q?=EA=B4=80=EB=A6=AC=EC=9E=90=20=EC=A7=80=EC=8B=9C)=20(=EA=B2=80?= =?UTF-8?q?=ED=86=A0=20=EB=8C=80=EA=B8=B0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 전체 시험 중 PC 가 바쁘면 정해진 횟수 (300 × 10ms) · 고정 시간 (20 · 100ms) 안에 계산이 끝나지 않아 흔들렸다 (11d709a 관리자 확인). idle 을 실제 시간 (최대 30초) 으로, 고정 기다림은 조건 (읽기 시작 · busy 가 풀림) 으로. 기대값은 그대로. Co-Authored-By: Claude Opus 5.5 --- test/folder_size_test.dart | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/test/folder_size_test.dart b/test/folder_size_test.dart index e192279..ac42e46 100644 --- a/test/folder_size_test.dart +++ b/test/folder_size_test.dart @@ -24,12 +24,16 @@ void main() { }); tearDown(() => tmp.deleteSync(recursive: true)); - Future idle(FolderSizes s, String path) async { - for (var i = 0; i < 300 && s.of(path) == null; i++) { + // 관리자 지적 (10/18): 전체 시험 중 PC 가 바쁘면 정해진 횟수 (300 × 10ms) 안에 끝나지 않아 흔들렸다 - 실제 시간으로 (최대 30초) 기다린다 + Future until(bool Function() ok, {Duration max = const Duration(seconds: 30)}) async { + final end = DateTime.now().add(max); + while (!ok() && DateTime.now().isBefore(end)) { await Future.delayed(const Duration(milliseconds: 10)); } } + Future idle(FolderSizes s, String path) => until(() => s.of(path) != null); + test('안쪽 폴더까지 합 · 기억 · 바뀌면 그 폴더 · 안쪽 · 위 폴더를 잊음', () async { var reads = 0; final s = FolderSizes(list: (d) { @@ -115,13 +119,14 @@ void main() { final a = p.join(tmp.path, 'a'), b = p.join(tmp.path, 'b'); s.request(a, forDir: tmp.path); // 세는 중 (gate 에서 기다림) s.request(b, forDir: tmp.path); // 기다리는 중 - await Future.delayed(const Duration(milliseconds: 20)); + await until(() => read.contains('a')); expect(s.busy(a) && s.busy(b), isTrue); // 다른 폴더로 감 s.retainAuto([p.join(tmp.path, 'elsewhere')]); expect(s.busy(b), isFalse, reason: '기다리던 것은 빠진다'); gate.complete(); - await Future.delayed(const Duration(milliseconds: 100)); + await until(() => !s.busy(a)); + expect(s.busy(a), isFalse); expect(s.of(a), isNull, reason: '세던 것은 멈추고 남기지 않는다'); expect(read, isNot(contains('b'))); @@ -134,11 +139,11 @@ void main() { // [cancel] s.request(a); s.cancel(a); - await Future.delayed(const Duration(milliseconds: 100)); + await until(() => !s.busy(a)); expect(s.of(a), isNull); expect(s.busy(a), isFalse); s.dispose(); - }); + }, timeout: const Timeout(Duration(minutes: 2))); test('크기순 정렬: 아는 폴더는 그 크기로, 모르는 폴더는 가장 작게 (폴더는 늘 위)', () { final now = DateTime(2026);