expectFormatParsing function

void expectFormatParsing(
  1. String content,
  2. MonoLingualFormat format,
  3. {List<MainMessage> messages = const []}
)

Compares a file content with the messages that are expected after parsing the file with the indicated format

Implementation

void expectFormatParsing(
  String content,
  MonoLingualFormat format, {
  List<MainMessage> messages = const [],
}) {
  final allTranslations = format.parseFile(content);

  for (final translated in allTranslations.messages.values) {
    final mainMessage = messages.firstWhere((e) => e.name == translated.id);
    final translatedMessage = translated.message..parent = mainMessage;
    expectMessage(translatedMessage, mainMessage);
  }
}