Files
clide/test/a11y/i18n_coverage_test.dart
T
jpmschweitzerandClaude Opus 4.8 6d0ebab721 chore: adopt Dart 3.9 toolchain — honest floor + tall-style reformat (T-353)
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>
2026-06-11 12:11:53 +02:00

39 lines
1.6 KiB
Dart

import 'dart:ui';
import 'package:clide/kernel/kernel.dart';
import 'package:flutter/services.dart' show rootBundle;
import 'package:flutter_test/flutter_test.dart';
/// Asserts every bundled i18n catalog is well-formed and every key the
/// Tier-0 built-ins ask for actually resolves.
///
/// The second check is important: in a text-driven i18n system missing
/// keys show the placeholder, so a runtime lookup test wouldn't "fail"
/// on a typo — we have to assert the keys exist up front.
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
/// (namespace, key) pairs referenced by Tier-0 built-ins. Extend when
/// new keys land.
const referenced = <String, List<String>>{
'builtin.welcome': ['title', 'subtitle', 'open-project', 'open-project.hint', 'tab.title'],
'builtin.ipc-status': ['connected', 'connected.hint', 'disconnected', 'disconnected.hint'],
'builtin.theme-picker': ['modal.title', 'modal.cancel', 'modal.cancel.hint', 'row.select.hint'],
'builtin.default-layout': ['command.reset', 'preset.classic'],
};
group('i18n coverage (Tier 0)', () {
for (final entry in referenced.entries) {
final ns = entry.key;
test('$ns catalog contains every referenced key', () async {
final loader = AssetCatalogLoader(bundle: rootBundle);
final catalog = await loader.load(ns, const Locale('en', 'US'));
expect(catalog, isNotEmpty, reason: 'catalog for "$ns" failed to load (asset path wrong?)');
for (final key in entry.value) {
expect(catalog.containsKey(key), isTrue, reason: 'namespace "$ns" catalog is missing key "$key"');
}
});
}
});
}