36 lines
2.0 KiB
Dart
36 lines
2.0 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:jj_mkvmaker/core/files/path_rules.dart' show appTempRsyncExcludes;
|
|
import 'package:jj_mkvmaker/core/sync_preview.dart' show runOptionsText;
|
|
import 'package:jj_mkvmaker/core/sync_tools.dart';
|
|
|
|
/// modular_sync F5 약속: 화면에 보이는 실행 옵션 글 = 실제 실행 인수 (rsyncArgs · robocopyRuns 가 만드는 것) - 예전에는
|
|
/// 탐색기 확인 창이 robocopy 이동을 /MOVE 로만 보였고, [최종 정리] 는 고친 옵션이 있어도 늘 -avHPOg 로 보였다
|
|
void main() {
|
|
const src = r'C:\src\Show', dst = r'D:\dst';
|
|
|
|
test('robocopy: 복사 · 이동 · 더 새것 건너뛰기 · 링크 옵션 - 실행 인수에서 경로를 뺀 것과 같음', () {
|
|
for (final (opts, move, skipNewer) in [
|
|
('/E /COPY:DAT /R:2 /W:2', false, false),
|
|
('/E /COPY:DAT /R:2 /W:2', true, false),
|
|
('/E /R:1 /MOVE', true, true),
|
|
('/E /SJ', false, true),
|
|
]) {
|
|
final run = robocopyRuns(options: opts, folders: [src], files: const [], dest: dst, move: move, skipNewer: skipNewer).single;
|
|
expect(runOptionsText(CopyMethod.robocopy, opts, move: move, skipNewer: skipNewer), run.sublist(2).join(' '),
|
|
reason: '$opts · 이동 $move · 건너뛰기 $skipNewer');
|
|
}
|
|
});
|
|
|
|
test('rsync: 복사는 원본 지우기 옵션을 빼고 · 이동만 --remove-source-files - 실행 인수 (경로 · 앱 임시 이름 빼기) 와 같음', () {
|
|
for (final (opts, move) in [('-avHPOg', false), ('-avHPOg', true), ('-av --remove-source-files --delete', false), ('-a --bwlimit=100', true)]) {
|
|
final args = rsyncArgs(options: opts, sources: [src], dest: dst, move: move, contents: true);
|
|
final shown = args.sublist(0, args.length - 2).where((a) => !appTempRsyncExcludes.contains(a)).join(' ');
|
|
expect(runOptionsText(CopyMethod.rsync, opts, move: move), shown, reason: '$opts · 이동 $move');
|
|
}
|
|
});
|
|
|
|
test('앱이 직접 (현재 방식) 은 빈 글', () {
|
|
expect(runOptionsText(CopyMethod.builtin, '-avHPOg', move: true), '');
|
|
});
|
|
}
|