test(#335): make the drift asset-version guard line-ending agnostic

The guard read pubspec.lock with a newline-sensitive regex, so it passed on
LF (CI) and failed on CRLF (Windows) for the same, correct assets. A guard
that is itself platform-fragile is worse than none. Normalise CRLF->LF before
matching.

Surfaced by the 290+306+335 integration merge, where the lockfile came through
with CRLF endings.
integration/290-306-335
Strycher 24 hours ago
parent 4cf2c632df
commit 06d3f027dd

@ -24,10 +24,14 @@ void main() {
'reproducible; the drift web assets are matched against it.',
);
// Normalise line endings first: pubspec.lock is CRLF on Windows and LF in
// CI, and a newline-sensitive pattern would pass on one and fail on the
// other. A guard that is itself platform-fragile is worse than none.
final lockText = lock.readAsStringSync().replaceAll('\r\n', '\n');
final resolved = RegExp(
r'^ drift:\n(?:.*\n)*? version: "([^"]+)"',
multiLine: true,
).firstMatch(lock.readAsStringSync())?.group(1);
).firstMatch(lockText)?.group(1);
expect(resolved, isNotNull, reason: 'drift not found in pubspec.lock');
final stamp = File('$root/web/drift_assets.version');

Loading…
Cancel
Save

Powered by TurnKey Linux.