26 lines
806 B
Dart
26 lines
806 B
Dart
// Author: fruit.com.cn
|
|
|
|
import 'dart:io';
|
|
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
test('should_use_theme_tokens_when_lib_code_is_scanned_for_legacy_blue', () {
|
|
final pattern = RegExp(
|
|
r'0xFF2F7BFF|0xff2F7BFF|0xFF8FB4FF|0xff8FB4FF|(?<!App)Colors\.blue\b',
|
|
);
|
|
final violations = <String>[];
|
|
for (final entity in Directory('lib').listSync(recursive: true)) {
|
|
if (entity is! File || !entity.path.endsWith('.dart')) continue;
|
|
final lines = entity.readAsLinesSync();
|
|
for (var index = 0; index < lines.length; index++) {
|
|
if (pattern.hasMatch(lines[index])) {
|
|
violations.add('${entity.path}:${index + 1}: ${lines[index].trim()}');
|
|
}
|
|
}
|
|
}
|
|
|
|
expect(violations, isEmpty, reason: violations.join('\n'));
|
|
});
|
|
}
|