[ffigen] Remove list_diff package (#456)
diff --git a/pkgs/ffigen/pubspec.yaml b/pkgs/ffigen/pubspec.yaml index 1bdec3a..f144be1 100644 --- a/pkgs/ffigen/pubspec.yaml +++ b/pkgs/ffigen/pubspec.yaml
@@ -23,5 +23,4 @@ dev_dependencies: lints: ^1.0.1 - list_diff: ^2.0.1 test: ^1.16.2
diff --git a/pkgs/ffigen/test/test_utils.dart b/pkgs/ffigen/test/test_utils.dart index fef4c4c..314f8aa 100644 --- a/pkgs/ffigen/test/test_utils.dart +++ b/pkgs/ffigen/test/test_utils.dart
@@ -5,7 +5,6 @@ import 'dart:io'; import 'package:ffigen/src/code_generator.dart'; -import 'package:list_diff/list_diff.dart' as list_diff; import 'package:logging/logging.dart'; import 'package:path/path.dart' as path; import 'package:test/test.dart'; @@ -41,43 +40,6 @@ } } -// String matcher for large strings, which prints the diffs between the expected -// and actual values, rather than just printing the entire strings. -class _LargeStringMatcher extends Matcher { - final String expected; - - _LargeStringMatcher(this.expected); - - @override - bool matches(dynamic item, Map matchState) { - return expected == item; - } - - @override - Description describe(Description description) { - return description.add('Has no diffs'); - } - - @override - Description describeMismatch(Object? item, Description mismatchDescription, - Map matchState, bool verbose) { - if (item is! String) { - return mismatchDescription.add('is ').addDescriptionOf(item); - } - return mismatchDescription.add('has diff:\n').add(_diff(item)); - } - - String _diff(String actual) { - final out = StringBuffer(); - for (final op - in list_diff.diffSync(expected.split('\n'), actual.split('\n'))) { - out.write(op.isInsertion ? 'ACT ' : 'EXP '); - out.write('${op.index}\t${op.item}\n'); - } - return out.toString(); - } -} - /// Generates actual file using library and tests using [expect] with expected /// /// This will not delete the actual debug file incase [expect] throws an error. @@ -93,7 +55,7 @@ final expected = File(path.joinAll(pathToExpected)) .readAsStringSync() .replaceAll('\r', ''); - expect(actual, _LargeStringMatcher(expected)); + expect(actual, expected); if (file.existsSync()) { file.delete(); }