Files
FlClash/test/setup_test.dart
T
chen08209 96fcb9ab5e chore(agents,tool): rebuild agent config, lint gates, CI, and release tooling
Rework .agents/, Claude/Codex config, CI workflows, lint gates and
lint-rule tests, and the release/changelog tooling. The 5% comment
density gate stays diff-scoped inside git hooks, where GIT_DIR outranks
the -C the gate uses to locate the repository. The tray icon generator
writes multi-size ICO files from the SVG sources into the per-platform
tray asset directories. The custom code-review subagents are gone: the
built-in /code-review never dispatched them, and the subagent model now
lives in a user-level setting outside the repository.

The Makefile, build_config.yaml and CI hand the Core and Helper builds to
the setup build hook, so the buildkit launchers go, and setup.dart
packages AppImage and rpm on arm64 with flutter_distributor pinned to the
fork tag that normalizes packaging permissions.

Changelog: skip
2026-09-10 12:42:52 +08:00

76 lines
2.0 KiB
Dart

import 'package:test/test.dart';
import '../setup.dart' as setup;
void main() {
group('setup.dart', () {
test('parses -v as verbose mode', () {
final results = setup.createSetupArgParser().parse(['android', '-v']);
expect(results['verbose'], isTrue);
expect(results.rest, ['android']);
});
test('accepts dev application environment', () {
final results = setup.createSetupArgParser().parse([
'android',
'--env',
'dev',
]);
expect(results['env'], 'dev');
});
test('Flutter build environment does not depend on Core SHA256', () {
expect(setup.createBuildEnvironment('dev'), {'APP_ENV': 'dev'});
});
test('omits verbose from flutter build args by default', () {
final args = setup.createFlutterBuildArgs(
platform: 'android',
verbose: false,
);
expect(args, ['dart-define-from-file=env.json', 'split-per-abi']);
});
test('adds verbose to flutter build args with -v', () {
final args = setup.createFlutterBuildArgs(
platform: 'android',
verbose: true,
);
expect(args, [
'verbose',
'dart-define-from-file=env.json',
'split-per-abi',
]);
});
test('refuses to package while a native build hook is skipped', () {
const pubspec = '''
hooks:
user_defines:
setup:
build_assets: false
rust_api:
build_assets: true
''';
expect(setup.packagesNotBuildingAssets(pubspec), ['setup']);
expect(setup.packagesNotBuildingAssets('name: x\n'), isEmpty);
});
test('packages every Linux format on every architecture', () {
expect(setup.createPackageTargets('linux', null), 'deb,appimage,rpm');
expect(setup.createPackageTargets('linux', 'deb'), 'deb');
expect(setup.createPackageTargets('macos', null), 'dmg');
});
test('downloads the appimagetool build matching the host', () {
expect(setup.appImageToolArch('arm64'), 'aarch64');
expect(setup.appImageToolArch('amd64'), 'x86_64');
});
});
}