testing library
A conformance suite for FluentBackend implementations.
A backend author (or a satellite package) runs fluentBackendConformanceChecks
against a real bundle and wires each returned check into their test
runner — this library deliberately does NOT depend on package:test,
so the core stays pure:
import 'package:fluent_bundle/testing.dart';
import 'package:fluent_intl/fluent_intl.dart';
import 'package:test/test.dart';
void main() {
for (final c in fluentBackendConformanceChecks(IntlBackend.new)) {
test(c.name, c.run);
}
}
The pieces live under src/testing/: BackendExpectations declares a
backend's capability set; the check groups (checks_core,
checks_number, checks_datetime, checks_degrade) test every flag
in both directions — positive render when true, degrade+error when
false.
Classes
- BackendExpectations
-
What a particular backend is expected to support. The spec-fallback
FluentBackendsets everything false; CLDR backends declare exactly what they render. Every flag here has a matching conformance check — a backend's declaration IS tested, in both directions: atrueflag runs the positive rendering check, and (under recordsUnsupportedOptionErrors) afalseflag runs the degrade check (still renders, records an error, never throws).
Functions
-
fluentBackendConformanceChecks(
FluentBackend create(), {BackendExpectations expectations = const BackendExpectations()}) → List< ConformanceCheck> -
Build the conformance checks for the backend produced by
create, gated byexpectations.
Typedefs
- ConformanceCheck = ({String name, void Function() run})
-
One named conformance check: its
runthrows on failure.