Skip to content

Commit

Permalink
chore: perform LF normalization on .golden files (#952)
Browse files Browse the repository at this point in the history
  • Loading branch information
halildurmus authored Jan 16, 2025
1 parent c94b75a commit 96a7b97
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*.dart text
*.expect text
*.gradle text
*.golden text
*.golden text eol=lf
*.html text
*.java text
*.json text
Expand Down
4 changes: 1 addition & 3 deletions packages/generator/test/goldens_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,10 @@ void main() {
void compareGolden(String fileName, String content) {
File('test/goldens/$fileName.comparison').writeAsStringSync(content);
final golden = File('test/goldens/$fileName.golden').readAsStringSync();
expect(content, equals(golden.convertLineEndingsToLF()));
expect(content, equals(golden));
}

extension on String {
String convertLineEndingsToLF() => replaceAll('\r\n', '\n');

/// Formats this string.
String format() =>
DartFormatter(languageVersion: DartFormatter.latestLanguageVersion)
Expand Down

0 comments on commit 96a7b97

Please sign in to comment.