Fixes for analysis and Travis (#113)
- test on oldest support Dart SDK
- remove unneeded codereview.settings
- Fix latest pedantic lints
- Add prefer_generic_function_type_aliases
- Remove deprecated super_goes_last
- Fix two dartlang.org links
- bump min SDK, fix prefer_collection_literals
- test only master branch
diff --git a/.travis.yml b/.travis.yml
index 3d7f554..115eeb8 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,14 +1,20 @@
language: dart
dart:
+ - 2.2.0
- dev
dart_task:
- test: -p vm
xvfb: false
- test: -p firefox
- - dartanalyzer
- - dartfmt
+ - dartanalyzer: --fatal-infos --fatal-warnings .
+
+matrix:
+ include:
+ # Only validate formatting using the dev release
+ - dart: dev
+ dart_task: dartfmt
# Only building master means that we don't run two builds for each pull request.
branches:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0c98e4b..1a37c52 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 0.12.6
+
+- Update minimum Dart SDK to `2.2.0`.
+
## 0.12.5
- Add `isA()` to create `TypeMatcher` instances in a more fluent way.
@@ -92,7 +96,7 @@
## 0.12.0
* Moved a number of members to the
- [`unittest`](https://pub.dartlang.org/packages/unittest) package.
+ [`unittest`](https://pub.dev/packages/unittest) package.
* `TestFailure`, `ErrorFormatter`, `expect`, `fail`, and 'wrapAsync'.
* `completes`, `completion`, `throws`, and `throwsA` Matchers.
* The `Throws` class.
diff --git a/README.md b/README.md
index beff308..365d8dd 100644
--- a/README.md
+++ b/README.md
@@ -4,4 +4,4 @@
inspiration from [Hamcrest](https://code.google.com/p/hamcrest/).
For more information, see
-[Unit Testing with Dart](https://www.dartlang.org/articles/dart-unit-tests/).
+[Unit Testing with Dart](https://github.com/dart-lang/test/blob/master/pkgs/test/README.md#writing-tests).
diff --git a/analysis_options.yaml b/analysis_options.yaml
index 7e194ea..07e49b9 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -58,6 +58,7 @@
- prefer_contains
- prefer_equal_for_default_values
- prefer_final_fields
+ - prefer_generic_function_type_aliases
- prefer_initializing_formals
#- prefer_interpolation_to_compose_strings
- prefer_is_empty
@@ -66,7 +67,6 @@
- prefer_typing_uninitialized_variables
- recursive_getters
- slash_for_doc_comments
- - super_goes_last
- test_types_in_equals
- throw_in_finally
- type_init_formals
diff --git a/codereview.settings b/codereview.settings
deleted file mode 100644
index 2fd4dde..0000000
--- a/codereview.settings
+++ /dev/null
@@ -1,3 +0,0 @@
-CODE_REVIEW_SERVER: https://codereview.chromium.org/
-VIEW_VC: https://github.com/dart-lang/matcher/commit/
-CC_LIST: reviews@dartlang.org
\ No newline at end of file
diff --git a/lib/src/equals_matcher.dart b/lib/src/equals_matcher.dart
index 8963851..f296735 100644
--- a/lib/src/equals_matcher.dart
+++ b/lib/src/equals_matcher.dart
@@ -70,7 +70,9 @@
_writeLeading(buff, escapedItem, start);
_writeTrailing(buff, escapedItem, start);
buff.write('\n ');
- for (var i = start > 10 ? 14 : start; i > 0; i--) buff.write(' ');
+ for (var i = start > 10 ? 14 : start; i > 0; i--) {
+ buff.write(' ');
+ }
buff.write('^\n Differ at offset $start');
}
diff --git a/lib/src/iterable_matchers.dart b/lib/src/iterable_matchers.dart
index d004ba2..c17a20f 100644
--- a/lib/src/iterable_matchers.dart
+++ b/lib/src/iterable_matchers.dart
@@ -214,7 +214,7 @@
/// tracks the matchers that have been used _during_ this search.
bool _findPairing(List<List<int>> edges, int valueIndex, List<int> matched,
[Set<int> reserved]) {
- reserved ??= Set<int>();
+ reserved ??= <int>{};
final possiblePairings =
edges[valueIndex].where((m) => !reserved.contains(m));
for (final matcherIndex in possiblePairings) {
diff --git a/lib/src/pretty_print.dart b/lib/src/pretty_print.dart
index 71941b8..9fe8882 100644
--- a/lib/src/pretty_print.dart
+++ b/lib/src/pretty_print.dart
@@ -26,7 +26,7 @@
// Avoid looping infinitely on recursively-nested data structures.
if (seen.contains(object)) return "(recursive)";
- seen = seen.union(Set.from([object]));
+ seen = seen.union({object});
String pp(child) => _prettyPrint(child, indent + 2, seen, false);
if (object is Iterable) {
@@ -113,7 +113,7 @@
}
}
- return _prettyPrint(object, 0, Set(), true);
+ return _prettyPrint(object, 0, <Object>{}, true);
}
String _indent(int length) => List.filled(length, ' ').join('');
diff --git a/pubspec.yaml b/pubspec.yaml
index f109db1..06e2305 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,5 +1,5 @@
name: matcher
-version: 0.12.5
+version: 0.12.6-dev
description: >-
Support for specifying test expectations via an extensible Matcher class.
@@ -8,7 +8,7 @@
homepage: https://github.com/dart-lang/matcher
environment:
- sdk: '>=2.0.0 <3.0.0'
+ sdk: '>=2.2.0 <3.0.0'
dependencies:
stack_trace: ^1.2.0