parseTwinFixtureSuite function

TwinFixtureSuite parseTwinFixtureSuite(
  1. String path,
  2. dynamic json
)

Validates one fixture file's decoded JSON into a typed suite.

Exported so a package can lint its fixtures without running them, and so the failure is attributable to a file even when the caller supplies the JSON itself.

Implementation

TwinFixtureSuite parseTwinFixtureSuite(String path, dynamic json) {
  final root = _object(path, json);
  final cases = _list('$path.cases', root['cases']);
  return TwinFixtureSuite(
    path: path,
    schemaVersion: _int('$path.schemaVersion', root['schemaVersion']),
    cases: [
      for (final (index, raw) in cases.indexed)
        _parseCase('$path.cases[$index]', raw),
    ],
  );
}