Dartfmt the entire package
diff --git a/lib/src/core_matchers.dart b/lib/src/core_matchers.dart
index a313d31..3ecbb9d 100644
--- a/lib/src/core_matchers.dart
+++ b/lib/src/core_matchers.dart
@@ -121,7 +121,7 @@
var expectedIterator = expected.iterator;
var actualIterator = actual.iterator;
- for (var index = 0; ; index++) {
+ for (var index = 0;; index++) {
// Advance in lockstep.
var expectedNext = expectedIterator.moveNext();
var actualNext = actualIterator.moveNext();
@@ -528,8 +528,8 @@
Description describeMismatch(
item, Description mismatchDescription, Map matchState, bool verbose) {
if (item is String || item is Iterable || item is Map) {
- return super.describeMismatch(
- item, mismatchDescription, matchState, verbose);
+ return super
+ .describeMismatch(item, mismatchDescription, matchState, verbose);
} else {
return mismatchDescription.add('is not a string, map or iterable');
}
diff --git a/lib/src/interfaces.dart b/lib/src/interfaces.dart
index 0183671..1c8091e 100644
--- a/lib/src/interfaces.dart
+++ b/lib/src/interfaces.dart
@@ -52,7 +52,7 @@
/// A few matchers make use of the [verbose] flag to provide detailed
/// information that is not typically included but can be of help in
/// diagnosing failures, such as stack traces.
- Description describeMismatch(
- item, Description mismatchDescription, Map matchState, bool verbose) =>
+ Description describeMismatch(item, Description mismatchDescription,
+ Map matchState, bool verbose) =>
mismatchDescription;
}
diff --git a/lib/src/iterable_matchers.dart b/lib/src/iterable_matchers.dart
index 55724b7..b394e74 100644
--- a/lib/src/iterable_matchers.dart
+++ b/lib/src/iterable_matchers.dart
@@ -55,8 +55,8 @@
mismatchDescription.add(' at index $index');
return mismatchDescription;
}
- return super.describeMismatch(
- item, mismatchDescription, matchState, verbose);
+ return super
+ .describeMismatch(item, mismatchDescription, matchState, verbose);
}
}
@@ -136,8 +136,8 @@
if (item is! Iterable) {
return mismatchDescription.addDescriptionOf(item).add(' not an Iterable');
} else {
- return super.describeMismatch(
- item, mismatchDescription, matchState, verbose);
+ return super
+ .describeMismatch(item, mismatchDescription, matchState, verbose);
}
}
}
@@ -200,8 +200,8 @@
.addAll('[', ', ', ']', _expected)
.add(' unordered');
- Description describeMismatch(
- item, Description mismatchDescription, Map matchState, bool verbose) =>
+ Description describeMismatch(item, Description mismatchDescription,
+ Map matchState, bool verbose) =>
mismatchDescription.add(_test(item));
}
@@ -211,8 +211,8 @@
/// returning whether they match, will be applied to each pair in order.
/// [description] should be a meaningful name for the comparator.
Matcher pairwiseCompare(
- Iterable expected, bool comparator(a, b), String description) =>
- new _PairwiseCompare(expected, comparator, description);
+ Iterable expected, bool comparator(a, b), String description) =>
+ new _PairwiseCompare(expected, comparator, description);
typedef bool _Comparator(a, b);
@@ -231,11 +231,8 @@
for (var e in _expected) {
iterator.moveNext();
if (!_comparator(e, iterator.current)) {
- addStateInfo(matchState, {
- 'index': i,
- 'expected': e,
- 'actual': iterator.current
- });
+ addStateInfo(matchState,
+ {'index': i, 'expected': e, 'actual': iterator.current});
return false;
}
i++;
diff --git a/lib/src/numeric_matchers.dart b/lib/src/numeric_matchers.dart
index 909c118..e8651de 100644
--- a/lib/src/numeric_matchers.dart
+++ b/lib/src/numeric_matchers.dart
@@ -85,18 +85,18 @@
return true;
}
- Description describe(Description description) => description.add(
- "be in range from "
- "$_low (${_lowMatchValue ? 'inclusive' : 'exclusive'}) to "
- "$_high (${_highMatchValue ? 'inclusive' : 'exclusive'})");
+ Description describe(Description description) =>
+ description.add("be in range from "
+ "$_low (${_lowMatchValue ? 'inclusive' : 'exclusive'}) to "
+ "$_high (${_highMatchValue ? 'inclusive' : 'exclusive'})");
Description describeMismatch(
item, Description mismatchDescription, Map matchState, bool verbose) {
if (item is! num) {
return mismatchDescription.addDescriptionOf(item).add(' not numeric');
} else {
- return super.describeMismatch(
- item, mismatchDescription, matchState, verbose);
+ return super
+ .describeMismatch(item, mismatchDescription, matchState, verbose);
}
}
}
diff --git a/lib/src/pretty_print.dart b/lib/src/pretty_print.dart
index 9b0a789..826cad0 100644
--- a/lib/src/pretty_print.dart
+++ b/lib/src/pretty_print.dart
@@ -49,9 +49,13 @@
}
// Otherwise, print each member on its own line.
- return "$type[\n" + strings.map((string) {
- return _indent(indent + 2) + string;
- }).join(",\n") + "\n" + _indent(indent) + "]";
+ return "$type[\n" +
+ strings.map((string) {
+ return _indent(indent + 2) + string;
+ }).join(",\n") +
+ "\n" +
+ _indent(indent) +
+ "]";
} else if (object is Map) {
// Convert the contents of the map to string representations.
var strings = object.keys.map((key) {
@@ -73,9 +77,13 @@
}
// Otherwise, print each key/value pair on its own line.
- return "{\n" + strings.map((string) {
- return _indent(indent + 2) + string;
- }).join(",\n") + "\n" + _indent(indent) + "}";
+ return "{\n" +
+ strings.map((string) {
+ return _indent(indent + 2) + string;
+ }).join(",\n") +
+ "\n" +
+ _indent(indent) +
+ "}";
} else if (object is String) {
// Escape strings and print each line on its own line.
var lines = object.split("\n");
diff --git a/lib/src/string_matchers.dart b/lib/src/string_matchers.dart
index eb0b464..d8bbdb8 100644
--- a/lib/src/string_matchers.dart
+++ b/lib/src/string_matchers.dart
@@ -65,8 +65,8 @@
.addDescriptionOf(collapseWhitespace(item))
.add(' with whitespace compressed');
} else {
- return super.describeMismatch(
- item, mismatchDescription, matchState, verbose);
+ return super
+ .describeMismatch(item, mismatchDescription, matchState, verbose);
}
}
}
@@ -169,8 +169,8 @@
if (!(item is String)) {
return mismatchDescription.addDescriptionOf(item).add(' not a string');
} else {
- return super.describeMismatch(
- item, mismatchDescription, matchState, verbose);
+ return super
+ .describeMismatch(item, mismatchDescription, matchState, verbose);
}
}
}
diff --git a/test/core_matchers_test.dart b/test/core_matchers_test.dart
index 4d0e4bf..a31391b 100644
--- a/test/core_matchers_test.dart
+++ b/test/core_matchers_test.dart
@@ -61,34 +61,18 @@
shouldPass(set2, equals(set1));
shouldPass(numbers, equals(set1));
- shouldFail([
- 1,
- 2,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8,
- 9
- ], equals(set1), matches(r"Expected: .*:\[1, 2, 3, 4, 5, 6, 7, 8, 9, 10\]"
- r" Actual: \[1, 2, 3, 4, 5, 6, 7, 8, 9\]"
- r" Which: does not contain 10"));
- shouldFail([
- 1,
- 2,
- 3,
- 4,
- 5,
- 6,
- 7,
- 8,
- 9,
- 10,
- 11
- ], equals(set1), matches(r"Expected: .*:\[1, 2, 3, 4, 5, 6, 7, 8, 9, 10\]"
- r" Actual: \[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11\]"
- r" Which: larger than expected"));
+ shouldFail(
+ [1, 2, 3, 4, 5, 6, 7, 8, 9],
+ equals(set1),
+ matches(r"Expected: .*:\[1, 2, 3, 4, 5, 6, 7, 8, 9, 10\]"
+ r" Actual: \[1, 2, 3, 4, 5, 6, 7, 8, 9\]"
+ r" Which: does not contain 10"));
+ shouldFail(
+ [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
+ equals(set1),
+ matches(r"Expected: .*:\[1, 2, 3, 4, 5, 6, 7, 8, 9, 10\]"
+ r" Actual: \[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11\]"
+ r" Which: larger than expected"));
});
test('anything', () {
@@ -101,9 +85,12 @@
test('returnsNormally', () {
shouldPass(doesNotThrow, returnsNormally);
- shouldFail(doesThrow, returnsNormally, matches(r"Expected: return normally"
- r" Actual: <Closure.*>"
- r" Which: threw 'X'"));
+ shouldFail(
+ doesThrow,
+ returnsNormally,
+ matches(r"Expected: return normally"
+ r" Actual: <Closure.*>"
+ r" Which: threw 'X'"));
});
test('hasLength', () {
@@ -112,56 +99,107 @@
shouldPass(a, hasLength(0));
shouldPass(b, hasLength(0));
shouldPass('a', hasLength(1));
- shouldFail(0, hasLength(0),
+ shouldFail(
+ 0,
+ hasLength(0),
"Expected: an object with length of <0> "
"Actual: <0> "
"Which: has no length property");
b.add(0);
shouldPass(b, hasLength(1));
- shouldFail(b, hasLength(2), "Expected: an object with length of <2> "
+ shouldFail(
+ b,
+ hasLength(2),
+ "Expected: an object with length of <2> "
"Actual: [0] "
"Which: has length of <1>");
b.add(0);
- shouldFail(b, hasLength(1), "Expected: an object with length of <1> "
+ shouldFail(
+ b,
+ hasLength(1),
+ "Expected: an object with length of <1> "
"Actual: [0, 0] "
"Which: has length of <2>");
shouldPass(b, hasLength(2));
});
test('scalar type mismatch', () {
- shouldFail('error', equals(5.1), "Expected: <5.1> "
+ shouldFail(
+ 'error',
+ equals(5.1),
+ "Expected: <5.1> "
"Actual: 'error'");
});
test('nested type mismatch', () {
- shouldFail(['error'], equals([5.1]), "Expected: [5.1] "
+ shouldFail(
+ ['error'],
+ equals([5.1]),
+ "Expected: [5.1] "
"Actual: ['error'] "
"Which: was 'error' instead of <5.1> at location [0]");
});
test('doubly-nested type mismatch', () {
- shouldFail([['error']], equals([[5.1]]), "Expected: [[5.1]] "
+ shouldFail(
+ [
+ ['error']
+ ],
+ equals([
+ [5.1]
+ ]),
+ "Expected: [[5.1]] "
"Actual: [['error']] "
"Which: was 'error' instead of <5.1> at location [0][0]");
});
test('doubly nested inequality', () {
- var actual1 = [['foo', 'bar'], ['foo'], 3, []];
- var expected1 = [['foo', 'bar'], ['foo'], 4, []];
+ var actual1 = [
+ ['foo', 'bar'],
+ ['foo'],
+ 3,
+ []
+ ];
+ var expected1 = [
+ ['foo', 'bar'],
+ ['foo'],
+ 4,
+ []
+ ];
var reason1 = "Expected: [['foo', 'bar'], ['foo'], 4, []] "
"Actual: [['foo', 'bar'], ['foo'], 3, []] "
"Which: was <3> instead of <4> at location [2]";
- var actual2 = [['foo', 'barry'], ['foo'], 4, []];
- var expected2 = [['foo', 'bar'], ['foo'], 4, []];
+ var actual2 = [
+ ['foo', 'barry'],
+ ['foo'],
+ 4,
+ []
+ ];
+ var expected2 = [
+ ['foo', 'bar'],
+ ['foo'],
+ 4,
+ []
+ ];
var reason2 = "Expected: [['foo', 'bar'], ['foo'], 4, []] "
"Actual: [['foo', 'barry'], ['foo'], 4, []] "
"Which: was 'barry' instead of 'bar' at location [0][1]";
- var actual3 = [['foo', 'bar'], ['foo'], 4, {'foo': 'bar'}];
- var expected3 = [['foo', 'bar'], ['foo'], 4, {'foo': 'barry'}];
+ var actual3 = [
+ ['foo', 'bar'],
+ ['foo'],
+ 4,
+ {'foo': 'bar'}
+ ];
+ var expected3 = [
+ ['foo', 'bar'],
+ ['foo'],
+ 4,
+ {'foo': 'barry'}
+ ];
var reason3 = "Expected: [['foo', 'bar'], ['foo'], 4, {'foo': 'barry'}] "
"Actual: [['foo', 'bar'], ['foo'], 4, {'foo': 'bar'}] "
"Which: was 'bar' instead of 'barry' at location [3]['foo']";
@@ -190,7 +228,9 @@
w.price = 10;
shouldPass(w, new HasPrice(10));
shouldPass(w, new HasPrice(greaterThan(0)));
- shouldFail(w, new HasPrice(greaterThan(10)),
+ shouldFail(
+ w,
+ new HasPrice(greaterThan(10)),
"Expected: Widget with a price that is a value greater than <10> "
"Actual: <Instance of 'Widget'> "
"Which: has price with value <10> which is not "
diff --git a/test/escape_test.dart b/test/escape_test.dart
index 265e24a..348afe0 100644
--- a/test/escape_test.dart
+++ b/test/escape_test.dart
@@ -18,7 +18,8 @@
_testEscaping('ASCII control character', '\x11', r'\x11');
_testEscaping('delete', '\x7F', r'\x7F');
_testEscaping('escape combos', r'\n', r'\\n');
- _testEscaping('All characters',
+ _testEscaping(
+ 'All characters',
'A new line\nA charriage return\rA form feed\fA backspace\b'
'A tab\tA vertical tab\vA slash\\A null byte\x00A control char\x1D'
'A delete\x7F',
@@ -40,7 +41,7 @@
var escaped = escape(source);
expect(escaped == target, isTrue,
reason: "Expected escaped value: $target\n"
- " Actual escaped value: $escaped");
+ " Actual escaped value: $escaped");
});
}
diff --git a/test/iterable_matchers_test.dart b/test/iterable_matchers_test.dart
index faab916..f76613b 100644
--- a/test/iterable_matchers_test.dart
+++ b/test/iterable_matchers_test.dart
@@ -21,14 +21,19 @@
test('contains', () {
var d = [1, 2];
shouldPass(d, contains(1));
- shouldFail(d, contains(0), "Expected: contains <0> "
+ shouldFail(
+ d,
+ contains(0),
+ "Expected: contains <0> "
"Actual: [1, 2]");
});
test('equals with matcher element', () {
var d = ['foo', 'bar'];
shouldPass(d, equals(['foo', startsWith('ba')]));
- shouldFail(d, equals(['foo', endsWith('ba')]),
+ shouldFail(
+ d,
+ equals(['foo', endsWith('ba')]),
"Expected: ['foo', <a string ending with 'ba'>] "
"Actual: ['foo', 'bar'] "
"Which: does not match a string ending with 'ba' at location [1]");
@@ -43,36 +48,53 @@
test('everyElement', () {
var d = [1, 2];
var e = [1, 1, 1];
- shouldFail(d, everyElement(1), "Expected: every element(<1>) "
+ shouldFail(
+ d,
+ everyElement(1),
+ "Expected: every element(<1>) "
"Actual: [1, 2] "
"Which: has value <2> which doesn't match <1> at index 1");
shouldPass(e, everyElement(1));
});
test('nested everyElement', () {
- var d = [['foo', 'bar'], ['foo'], []];
- var e = [['foo', 'bar'], ['foo'], 3, []];
+ var d = [
+ ['foo', 'bar'],
+ ['foo'],
+ []
+ ];
+ var e = [
+ ['foo', 'bar'],
+ ['foo'],
+ 3,
+ []
+ ];
shouldPass(d, everyElement(anyOf(isEmpty, contains('foo'))));
- shouldFail(d, everyElement(everyElement(equals('foo'))),
+ shouldFail(
+ d,
+ everyElement(everyElement(equals('foo'))),
"Expected: every element(every element('foo')) "
"Actual: [['foo', 'bar'], ['foo'], []] "
"Which: has value ['foo', 'bar'] which has value 'bar' "
"which is different. Expected: foo Actual: bar ^ "
"Differ at offset 0 at index 1 at index 0");
- shouldFail(d,
+ shouldFail(
+ d,
everyElement(allOf(hasLength(greaterThan(0)), contains('foo'))),
"Expected: every element((an object with length of a value "
"greater than <0> and contains 'foo')) "
"Actual: [['foo', 'bar'], ['foo'], []] "
"Which: has value [] which has length of <0> at index 2");
- shouldFail(d,
+ shouldFail(
+ d,
everyElement(allOf(contains('foo'), hasLength(greaterThan(0)))),
"Expected: every element((contains 'foo' and "
"an object with length of a value greater than <0>)) "
"Actual: [['foo', 'bar'], ['foo'], []] "
"Which: has value [] which doesn't match (contains 'foo' and "
"an object with length of a value greater than <0>) at index 2");
- shouldFail(e,
+ shouldFail(
+ e,
everyElement(allOf(contains('foo'), hasLength(greaterThan(0)))),
"Expected: every element((contains 'foo' and an object with "
"length of a value greater than <0>)) "
@@ -93,7 +115,10 @@
shouldPass([null], orderedEquals([null]));
var d = [1, 2];
shouldPass(d, orderedEquals([1, 2]));
- shouldFail(d, orderedEquals([2, 1]), "Expected: equals [2, 1] ordered "
+ shouldFail(
+ d,
+ orderedEquals([2, 1]),
+ "Expected: equals [2, 1] ordered "
"Actual: [1, 2] "
"Which: was <1> instead of <2> at location [0]");
});
@@ -101,14 +126,22 @@
test('unorderedEquals', () {
var d = [1, 2];
shouldPass(d, unorderedEquals([2, 1]));
- shouldFail(d, unorderedEquals([1]), "Expected: equals [1] unordered "
+ shouldFail(
+ d,
+ unorderedEquals([1]),
+ "Expected: equals [1] unordered "
"Actual: [1, 2] "
"Which: has too many elements (2 > 1)");
- shouldFail(d, unorderedEquals([3, 2, 1]),
+ shouldFail(
+ d,
+ unorderedEquals([3, 2, 1]),
"Expected: equals [3, 2, 1] unordered "
"Actual: [1, 2] "
"Which: has too few elements (2 < 3)");
- shouldFail(d, unorderedEquals([3, 1]), "Expected: equals [3, 1] unordered "
+ shouldFail(
+ d,
+ unorderedEquals([3, 1]),
+ "Expected: equals [3, 1] unordered "
"Actual: [1, 2] "
"Which: has no match for <3> at index 0");
});
@@ -117,19 +150,27 @@
var d = [1, 2];
shouldPass(d, unorderedMatches([2, 1]));
shouldPass(d, unorderedMatches([greaterThan(1), greaterThan(0)]));
- shouldFail(d, unorderedMatches([greaterThan(0)]),
+ shouldFail(
+ d,
+ unorderedMatches([greaterThan(0)]),
"Expected: matches [a value greater than <0>] unordered "
"Actual: [1, 2] "
"Which: has too many elements (2 > 1)");
- shouldFail(d, unorderedMatches([3, 2, 1]),
+ shouldFail(
+ d,
+ unorderedMatches([3, 2, 1]),
"Expected: matches [<3>, <2>, <1>] unordered "
"Actual: [1, 2] "
"Which: has too few elements (2 < 3)");
- shouldFail(d, unorderedMatches([3, 1]),
+ shouldFail(
+ d,
+ unorderedMatches([3, 1]),
"Expected: matches [<3>, <1>] unordered "
"Actual: [1, 2] "
"Which: has no match for <3> at index 0");
- shouldFail(d, unorderedMatches([greaterThan(3), greaterThan(0)]),
+ shouldFail(
+ d,
+ unorderedMatches([greaterThan(3), greaterThan(0)]),
"Expected: matches [a value greater than <3>, a value greater than "
"<0>] unordered "
"Actual: [1, 2] "
@@ -140,21 +181,29 @@
var c = [1, 2];
var d = [1, 2, 3];
var e = [1, 4, 9];
- shouldFail('x', pairwiseCompare(e, (e, a) => a <= e, "less than or equal"),
+ shouldFail(
+ 'x',
+ pairwiseCompare(e, (e, a) => a <= e, "less than or equal"),
"Expected: pairwise less than or equal [1, 4, 9] "
"Actual: 'x' "
"Which: is not an Iterable");
- shouldFail(c, pairwiseCompare(e, (e, a) => a <= e, "less than or equal"),
+ shouldFail(
+ c,
+ pairwiseCompare(e, (e, a) => a <= e, "less than or equal"),
"Expected: pairwise less than or equal [1, 4, 9] "
"Actual: [1, 2] "
"Which: has length 2 instead of 3");
shouldPass(d, pairwiseCompare(e, (e, a) => a <= e, "less than or equal"));
- shouldFail(d, pairwiseCompare(e, (e, a) => a < e, "less than"),
+ shouldFail(
+ d,
+ pairwiseCompare(e, (e, a) => a < e, "less than"),
"Expected: pairwise less than [1, 4, 9] "
"Actual: [1, 2, 3] "
"Which: has <1> which is not less than <1> at index 0");
shouldPass(d, pairwiseCompare(e, (e, a) => a * a == e, "square root of"));
- shouldFail(d, pairwiseCompare(e, (e, a) => a + a == e, "double"),
+ shouldFail(
+ d,
+ pairwiseCompare(e, (e, a) => a + a == e, "double"),
"Expected: pairwise double [1, 4, 9] "
"Actual: [1, 2, 3] "
"Which: has <1> which is not double <1> at index 0");
@@ -164,7 +213,10 @@
var d = new SimpleIterable(0);
var e = new SimpleIterable(1);
shouldPass(d, isEmpty);
- shouldFail(e, isEmpty, "Expected: empty "
+ shouldFail(
+ e,
+ isEmpty,
+ "Expected: empty "
"Actual: SimpleIterable:[1]");
});
@@ -172,14 +224,20 @@
var d = new SimpleIterable(0);
var e = new SimpleIterable(1);
shouldPass(e, isNotEmpty);
- shouldFail(d, isNotEmpty, "Expected: non-empty "
+ shouldFail(
+ d,
+ isNotEmpty,
+ "Expected: non-empty "
"Actual: SimpleIterable:[]");
});
test('contains', () {
var d = new SimpleIterable(3);
shouldPass(d, contains(2));
- shouldFail(d, contains(5), "Expected: contains <5> "
+ shouldFail(
+ d,
+ contains(5),
+ "Expected: contains <5> "
"Actual: SimpleIterable:[3, 2, 1]");
});
}
diff --git a/test/mirror_matchers_test.dart b/test/mirror_matchers_test.dart
index 50f786b..729768e 100644
--- a/test/mirror_matchers_test.dart
+++ b/test/mirror_matchers_test.dart
@@ -18,22 +18,31 @@
test('hasProperty', () {
var foo = [3];
shouldPass(foo, hasProperty('length', 1));
- shouldFail(foo, hasProperty('foo'), 'Expected: has property "foo" '
+ shouldFail(
+ foo,
+ hasProperty('foo'),
+ 'Expected: has property "foo" '
'Actual: [3] '
'Which: has no property named "foo"');
- shouldFail(foo, hasProperty('length', 2),
+ shouldFail(
+ foo,
+ hasProperty('length', 2),
'Expected: has property "length" which matches <2> '
'Actual: [3] '
'Which: has property "length" with value <1>');
var c = new C();
shouldPass(c, hasProperty('instanceField', 1));
shouldPass(c, hasProperty('instanceGetter', 2));
- shouldFail(c, hasProperty('staticField'),
+ shouldFail(
+ c,
+ hasProperty('staticField'),
'Expected: has property "staticField" '
'Actual: <Instance of \'C\'> '
'Which: has a member named "staticField",'
' but it is not an instance property');
- shouldFail(c, hasProperty('staticGetter'),
+ shouldFail(
+ c,
+ hasProperty('staticGetter'),
'Expected: has property "staticGetter" '
'Actual: <Instance of \'C\'> '
'Which: has a member named "staticGetter",'
diff --git a/test/numeric_matchers_test.dart b/test/numeric_matchers_test.dart
index 4065f3e..9a365d8 100644
--- a/test/numeric_matchers_test.dart
+++ b/test/numeric_matchers_test.dart
@@ -12,40 +12,54 @@
shouldPass(0, closeTo(0, 1));
shouldPass(-1, closeTo(0, 1));
shouldPass(1, closeTo(0, 1));
- shouldFail(1.001, closeTo(0, 1),
+ shouldFail(
+ 1.001,
+ closeTo(0, 1),
"Expected: a numeric value within <1> of <0> "
"Actual: <1.001> "
"Which: differs by <1.001>");
- shouldFail(-1.001, closeTo(0, 1),
+ shouldFail(
+ -1.001,
+ closeTo(0, 1),
"Expected: a numeric value within <1> of <0> "
"Actual: <-1.001> "
"Which: differs by <1.001>");
});
test('inInclusiveRange', () {
- shouldFail(-1, inInclusiveRange(0, 2),
+ shouldFail(
+ -1,
+ inInclusiveRange(0, 2),
"Expected: be in range from 0 (inclusive) to 2 (inclusive) "
"Actual: <-1>");
shouldPass(0, inInclusiveRange(0, 2));
shouldPass(1, inInclusiveRange(0, 2));
shouldPass(2, inInclusiveRange(0, 2));
- shouldFail(3, inInclusiveRange(0, 2),
+ shouldFail(
+ 3,
+ inInclusiveRange(0, 2),
"Expected: be in range from 0 (inclusive) to 2 (inclusive) "
"Actual: <3>");
});
test('inExclusiveRange', () {
- shouldFail(0, inExclusiveRange(0, 2),
+ shouldFail(
+ 0,
+ inExclusiveRange(0, 2),
"Expected: be in range from 0 (exclusive) to 2 (exclusive) "
"Actual: <0>");
shouldPass(1, inExclusiveRange(0, 2));
- shouldFail(2, inExclusiveRange(0, 2),
+ shouldFail(
+ 2,
+ inExclusiveRange(0, 2),
"Expected: be in range from 0 (exclusive) to 2 (exclusive) "
"Actual: <2>");
});
test('inOpenClosedRange', () {
- shouldFail(0, inOpenClosedRange(0, 2),
+ shouldFail(
+ 0,
+ inOpenClosedRange(0, 2),
"Expected: be in range from 0 (exclusive) to 2 (inclusive) "
"Actual: <0>");
shouldPass(1, inOpenClosedRange(0, 2));
@@ -55,7 +69,9 @@
test('inClosedOpenRange', () {
shouldPass(0, inClosedOpenRange(0, 2));
shouldPass(1, inClosedOpenRange(0, 2));
- shouldFail(2, inClosedOpenRange(0, 2),
+ shouldFail(
+ 2,
+ inClosedOpenRange(0, 2),
"Expected: be in range from 0 (inclusive) to 2 (exclusive) "
"Actual: <2>");
});
diff --git a/test/operator_matchers_test.dart b/test/operator_matchers_test.dart
index 7ad4163..20cd631 100644
--- a/test/operator_matchers_test.dart
+++ b/test/operator_matchers_test.dart
@@ -23,23 +23,31 @@
test('allOf', () {
// with a list
shouldPass(1, allOf([lessThan(10), greaterThan(0)]));
- shouldFail(-1, allOf([lessThan(10), greaterThan(0)]),
+ shouldFail(
+ -1,
+ allOf([lessThan(10), greaterThan(0)]),
"Expected: (a value less than <10> and a value greater than <0>) "
"Actual: <-1> "
"Which: is not a value greater than <0>");
// with individual items
shouldPass(1, allOf(lessThan(10), greaterThan(0)));
- shouldFail(-1, allOf(lessThan(10), greaterThan(0)),
+ shouldFail(
+ -1,
+ allOf(lessThan(10), greaterThan(0)),
"Expected: (a value less than <10> and a value greater than <0>) "
"Actual: <-1> "
"Which: is not a value greater than <0>");
// with maximum items
- shouldPass(1, allOf(lessThan(10), lessThan(9), lessThan(8),
- lessThan(7), lessThan(6), lessThan(5), lessThan(4)));
- shouldFail(4, allOf(lessThan(10), lessThan(9), lessThan(8), lessThan(7),
- lessThan(6), lessThan(5), lessThan(4)),
+ shouldPass(
+ 1,
+ allOf(lessThan(10), lessThan(9), lessThan(8), lessThan(7), lessThan(6),
+ lessThan(5), lessThan(4)));
+ shouldFail(
+ 4,
+ allOf(lessThan(10), lessThan(9), lessThan(8), lessThan(7), lessThan(6),
+ lessThan(5), lessThan(4)),
"Expected: (a value less than <10> and a value less than <9> and a "
"value less than <8> and a value less than <7> and a value less than "
"<6> and a value less than <5> and a value less than <4>) "
diff --git a/test/order_matchers_test.dart b/test/order_matchers_test.dart
index a2d60e8..ff09b6c 100644
--- a/test/order_matchers_test.dart
+++ b/test/order_matchers_test.dart
@@ -10,21 +10,29 @@
void main() {
test('greaterThan', () {
shouldPass(10, greaterThan(9));
- shouldFail(9, greaterThan(10), "Expected: a value greater than <10> "
+ shouldFail(
+ 9,
+ greaterThan(10),
+ "Expected: a value greater than <10> "
"Actual: <9> "
"Which: is not a value greater than <10>");
});
test('greaterThanOrEqualTo', () {
shouldPass(10, greaterThanOrEqualTo(10));
- shouldFail(9, greaterThanOrEqualTo(10),
+ shouldFail(
+ 9,
+ greaterThanOrEqualTo(10),
"Expected: a value greater than or equal to <10> "
"Actual: <9> "
"Which: is not a value greater than or equal to <10>");
});
test('lessThan', () {
- shouldFail(10, lessThan(9), "Expected: a value less than <9> "
+ shouldFail(
+ 10,
+ lessThan(9),
+ "Expected: a value less than <9> "
"Actual: <10> "
"Which: is not a value less than <9>");
shouldPass(9, lessThan(10));
@@ -32,7 +40,9 @@
test('lessThanOrEqualTo', () {
shouldPass(10, lessThanOrEqualTo(10));
- shouldFail(11, lessThanOrEqualTo(10),
+ shouldFail(
+ 11,
+ lessThanOrEqualTo(10),
"Expected: a value less than or equal to <10> "
"Actual: <11> "
"Which: is not a value less than or equal to <10>");
@@ -40,23 +50,35 @@
test('isZero', () {
shouldPass(0, isZero);
- shouldFail(1, isZero, "Expected: a value equal to <0> "
+ shouldFail(
+ 1,
+ isZero,
+ "Expected: a value equal to <0> "
"Actual: <1> "
"Which: is not a value equal to <0>");
});
test('isNonZero', () {
- shouldFail(0, isNonZero, "Expected: a value not equal to <0> "
+ shouldFail(
+ 0,
+ isNonZero,
+ "Expected: a value not equal to <0> "
"Actual: <0> "
"Which: is not a value not equal to <0>");
shouldPass(1, isNonZero);
});
test('isPositive', () {
- shouldFail(-1, isPositive, "Expected: a positive value "
+ shouldFail(
+ -1,
+ isPositive,
+ "Expected: a positive value "
"Actual: <-1> "
"Which: is not a positive value");
- shouldFail(0, isPositive, "Expected: a positive value "
+ shouldFail(
+ 0,
+ isPositive,
+ "Expected: a positive value "
"Actual: <0> "
"Which: is not a positive value");
shouldPass(1, isPositive);
@@ -64,7 +86,10 @@
test('isNegative', () {
shouldPass(-1, isNegative);
- shouldFail(0, isNegative, "Expected: a negative value "
+ shouldFail(
+ 0,
+ isNegative,
+ "Expected: a negative value "
"Actual: <0> "
"Which: is not a negative value");
});
@@ -72,7 +97,10 @@
test('isNonPositive', () {
shouldPass(-1, isNonPositive);
shouldPass(0, isNonPositive);
- shouldFail(1, isNonPositive, "Expected: a non-positive value "
+ shouldFail(
+ 1,
+ isNonPositive,
+ "Expected: a non-positive value "
"Actual: <1> "
"Which: is not a non-positive value");
});
@@ -80,7 +108,10 @@
test('isNonNegative', () {
shouldPass(1, isNonNegative);
shouldPass(0, isNonNegative);
- shouldFail(-1, isNonNegative, "Expected: a non-negative value "
+ shouldFail(
+ -1,
+ isNonNegative,
+ "Expected: a non-negative value "
"Actual: <-1> "
"Which: is not a non-negative value");
});
diff --git a/test/pretty_print_test.dart b/test/pretty_print_test.dart
index 551db45..c809df0 100644
--- a/test/pretty_print_test.dart
+++ b/test/pretty_print_test.dart
@@ -37,14 +37,16 @@
});
test('containing newlines', () {
- expect(prettyPrint('foo\nbar\nbaz'), equals("'foo\\n'\n"
- " 'bar\\n'\n"
- " 'baz'"));
+ expect(
+ prettyPrint('foo\nbar\nbaz'),
+ equals("'foo\\n'\n"
+ " 'bar\\n'\n"
+ " 'baz'"));
});
test('containing escapable characters', () {
- expect(
- prettyPrint("foo\rbar\tbaz'qux\v"), equals(r"'foo\rbar\tbaz\'qux\v'"));
+ expect(prettyPrint("foo\rbar\tbaz'qux\v"),
+ equals(r"'foo\rbar\tbaz\'qux\v'"));
});
});
@@ -54,13 +56,15 @@
});
test('containing a multiline string', () {
- expect(prettyPrint(['foo', 'bar\nbaz\nbip', 'qux']), equals("[\n"
- " 'foo',\n"
- " 'bar\\n'\n"
- " 'baz\\n'\n"
- " 'bip',\n"
- " 'qux'\n"
- "]"));
+ expect(
+ prettyPrint(['foo', 'bar\nbaz\nbip', 'qux']),
+ equals("[\n"
+ " 'foo',\n"
+ " 'bar\\n'\n"
+ " 'baz\\n'\n"
+ " 'bip',\n"
+ " 'qux'\n"
+ "]"));
});
test('containing a matcher', () {
@@ -74,7 +78,8 @@
});
test("that's over maxLineLength", () {
- expect(prettyPrint([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], maxLineLength: 29),
+ expect(
+ prettyPrint([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], maxLineLength: 29),
equals("[\n"
" 0,\n"
" 1,\n"
@@ -90,23 +95,27 @@
});
test("factors indentation into maxLineLength", () {
- expect(prettyPrint(["foo\nbar", [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],],
- maxLineLength: 30), equals("[\n"
- " 'foo\\n'\n"
- " 'bar',\n"
- " [\n"
- " 0,\n"
- " 1,\n"
- " 2,\n"
- " 3,\n"
- " 4,\n"
- " 5,\n"
- " 6,\n"
- " 7,\n"
- " 8,\n"
- " 9\n"
- " ]\n"
- "]"));
+ expect(
+ prettyPrint([
+ "foo\nbar",
+ [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
+ ], maxLineLength: 30),
+ equals("[\n"
+ " 'foo\\n'\n"
+ " 'bar',\n"
+ " [\n"
+ " 0,\n"
+ " 1,\n"
+ " 2,\n"
+ " 3,\n"
+ " 4,\n"
+ " 5,\n"
+ " 6,\n"
+ " 7,\n"
+ " 8,\n"
+ " 9\n"
+ " ]\n"
+ "]"));
});
test("that's under maxItems", () {
@@ -133,27 +142,33 @@
});
test('containing a multiline string key', () {
- expect(prettyPrint({'foo\nbar': 1, 'bar': true}), equals("{\n"
- " 'foo\\n'\n"
- " 'bar': 1,\n"
- " 'bar': true\n"
- "}"));
+ expect(
+ prettyPrint({'foo\nbar': 1, 'bar': true}),
+ equals("{\n"
+ " 'foo\\n'\n"
+ " 'bar': 1,\n"
+ " 'bar': true\n"
+ "}"));
});
test('containing a multiline string value', () {
- expect(prettyPrint({'foo': 'bar\nbaz', 'qux': true}), equals("{\n"
- " 'foo': 'bar\\n'\n"
- " 'baz',\n"
- " 'qux': true\n"
- "}"));
+ expect(
+ prettyPrint({'foo': 'bar\nbaz', 'qux': true}),
+ equals("{\n"
+ " 'foo': 'bar\\n'\n"
+ " 'baz',\n"
+ " 'qux': true\n"
+ "}"));
});
test('containing a multiline string key/value pair', () {
- expect(prettyPrint({'foo\nbar': 'baz\nqux'}), equals("{\n"
- " 'foo\\n'\n"
- " 'bar': 'baz\\n'\n"
- " 'qux'\n"
- "}"));
+ expect(
+ prettyPrint({'foo\nbar': 'baz\nqux'}),
+ equals("{\n"
+ " 'foo\\n'\n"
+ " 'bar': 'baz\\n'\n"
+ " 'qux'\n"
+ "}"));
});
test('containing a matcher key', () {
@@ -172,7 +187,8 @@
});
test("that's over maxLineLength", () {
- expect(prettyPrint({'0': 1, '2': 3, '4': 5, '6': 7}, maxLineLength: 31),
+ expect(
+ prettyPrint({'0': 1, '2': 3, '4': 5, '6': 7}, maxLineLength: 31),
equals("{\n"
" '0': 1,\n"
" '2': 3,\n"
@@ -182,17 +198,21 @@
});
test("factors indentation into maxLineLength", () {
- expect(prettyPrint(["foo\nbar", {'0': 1, '2': 3, '4': 5, '6': 7}],
- maxLineLength: 32), equals("[\n"
- " 'foo\\n'\n"
- " 'bar',\n"
- " {\n"
- " '0': 1,\n"
- " '2': 3,\n"
- " '4': 5,\n"
- " '6': 7\n"
- " }\n"
- "]"));
+ expect(
+ prettyPrint([
+ "foo\nbar",
+ {'0': 1, '2': 3, '4': 5, '6': 7}
+ ], maxLineLength: 32),
+ equals("[\n"
+ " 'foo\\n'\n"
+ " 'bar',\n"
+ " {\n"
+ " '0': 1,\n"
+ " '2': 3,\n"
+ " '4': 5,\n"
+ " '6': 7\n"
+ " }\n"
+ "]"));
});
test("that's under maxItems", () {
diff --git a/test/string_matchers_test.dart b/test/string_matchers_test.dart
index cab8693..5b5afe4 100644
--- a/test/string_matchers_test.dart
+++ b/test/string_matchers_test.dart
@@ -49,7 +49,9 @@
test('equalsIgnoringWhitespace', () {
shouldPass(' hello world ', equalsIgnoringWhitespace('hello world'));
- shouldFail(' helloworld ', equalsIgnoringWhitespace('hello world'),
+ shouldFail(
+ ' helloworld ',
+ equalsIgnoringWhitespace('hello world'),
"Expected: 'hello world' ignoring whitespace "
"Actual: ' helloworld ' "
"Which: is 'helloworld' with whitespace compressed");
@@ -59,7 +61,9 @@
shouldPass('hello', startsWith(''));
shouldPass('hello', startsWith('hell'));
shouldPass('hello', startsWith('hello'));
- shouldFail('hello', startsWith('hello '),
+ shouldFail(
+ 'hello',
+ startsWith('hello '),
"Expected: a string starting with 'hello ' "
"Actual: 'hello'");
});
@@ -68,7 +72,9 @@
shouldPass('hello', endsWith(''));
shouldPass('hello', endsWith('lo'));
shouldPass('hello', endsWith('hello'));
- shouldFail('hello', endsWith(' hello'),
+ shouldFail(
+ 'hello',
+ endsWith(' hello'),
"Expected: a string ending with ' hello' "
"Actual: 'hello'");
});
@@ -96,7 +102,8 @@
'goodbye cruel world', stringContainsInOrder(['cruel', 'world']));
shouldPass('goodbye cruel world',
stringContainsInOrder(['goodbye', 'cruel', 'world']));
- shouldFail('goodbye cruel world',
+ shouldFail(
+ 'goodbye cruel world',
stringContainsInOrder(['goo', 'cruel', 'bye']),
"Expected: a string containing 'goo', 'cruel', 'bye' in order "
"Actual: 'goodbye cruel world'");