From 7ad427bd88744b9ae65eba73f8f488c5b8459c65 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Tue, 12 May 2026 11:21:24 +0200 Subject: [PATCH] test sweep: cover I18n locale getters (T-91) Adds one test covering the currentLocale / defaultLocale / availableLocales getters on the I18n class. Existing suite exercised the lookup behaviour but never read back the three locale fields, leaving them as the last reachable gaps in lib/kernel/src/i18n/. Coverage: kernel/src/i18n/i18n.dart 54/58 -> 57/58. The 1 remaining line is the I18nReplacer const-constructor body (lcov phantom). Co-Authored-By: Claude Opus 4.7 (1M context) --- test/kernel/src/i18n/i18n_test.dart | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/kernel/src/i18n/i18n_test.dart b/test/kernel/src/i18n/i18n_test.dart index ab633a6b..9fa93d2a 100644 --- a/test/kernel/src/i18n/i18n_test.dart +++ b/test/kernel/src/i18n/i18n_test.dart @@ -29,6 +29,17 @@ void main() { return i; } + test('locale getters reflect constructor arguments', () { + final i = build( + catalogs: const {}, + initial: const Locale('nl', 'NL'), + defaultLocale: const Locale('en', 'US'), + ); + expect(i.currentLocale, const Locale('nl', 'NL')); + expect(i.defaultLocale, const Locale('en', 'US')); + expect(i.availableLocales, [const Locale('en', 'US'), const Locale('nl', 'NL')]); + }); + test('missing key with placeholder returns placeholder', () async { final i = build(catalogs: const {}); await i.ensureNamespaceLoaded('builtin.x');