Index: tests/lib/unittest/matchers_test.dart |
=================================================================== |
--- tests/lib/unittest/matchers_test.dart (revision 9562) |
+++ tests/lib/unittest/matchers_test.dart (working copy) |
@@ -33,29 +33,29 @@ |
test('isTrue', () { |
shouldPass(true, isTrue); |
- shouldFail(false, isTrue, "Expected: true but: was <false>"); |
+ shouldFail(false, isTrue, "Expected: true but: was <false>."); |
}); |
test('isFalse', () { |
shouldPass(false, isFalse); |
- shouldFail(true, isFalse, "Expected: false but: was <true>"); |
+ shouldFail(true, isFalse, "Expected: false but: was <true>."); |
}); |
test('isNull', () { |
shouldPass(null, isNull); |
- shouldFail(false, isNull, "Expected: null but: was <false>"); |
+ shouldFail(false, isNull, "Expected: null but: was <false>."); |
}); |
test('isNotNull', () { |
shouldPass(false, isNotNull); |
- shouldFail(null, isNotNull, "Expected: not null but: was <null>"); |
+ shouldFail(null, isNotNull, "Expected: not null but: was <null>."); |
}); |
test('same', () { |
var a = new Map(); |
var b = new Map(); |
shouldPass(a, same(a)); |
- shouldFail(b, same(a), "Expected: same instance as <{}> but: was <{}>"); |
+ shouldFail(b, same(a), "Expected: same instance as <{}> but: was <{}>."); |
}); |
test('equals', () { |
@@ -70,12 +70,12 @@ |
shouldPass(0, anything); |
shouldPass(null, anything); |
shouldPass(a, anything); |
- shouldFail(a, isNot(anything), "Expected: not anything but: was <{}>"); |
+ shouldFail(a, isNot(anything), "Expected: not anything but: was <{}>."); |
}); |
test('throws', () { |
shouldFail(doesNotThrow, throws, |
- "Expected: throws an exception but: no exception"); |
+ "Expected: throws an exception but: no exception."); |
shouldPass(doesThrow, throws); |
}); |
@@ -83,7 +83,7 @@ |
shouldPass(doesThrow, throwsA(equals('X'))); |
shouldFail(doesThrow, throwsA(equals('Y')), |
"Expected: throws an exception which matches 'Y' " |
- "but: no exception or exception does not match 'Y'"); |
+ "but: no exception or exception does not match 'Y'."); |
}); |
test('throwsBadNumberFormatException', () { |
@@ -93,7 +93,7 @@ |
throwsBadNumberFormatException, |
"Expected: throws an exception which matches BadNumberFormatException " |
"but: no exception or exception does not match " |
- "BadNumberFormatException"); |
+ "BadNumberFormatException."); |
}); |
test('throwsIllegalArgumentException', () { |
@@ -103,7 +103,7 @@ |
throwsIllegalArgumentException, |
"Expected: throws an exception which matches IllegalArgumentException " |
"but: no exception or exception does not match " |
- "IllegalArgumentException"); |
+ "IllegalArgumentException."); |
}); |
test('throwsIllegalJSRegExpException', () { |
@@ -113,7 +113,7 @@ |
throwsIllegalJSRegExpException, |
"Expected: throws an exception which matches IllegalJSRegExpException " |
"but: no exception or exception does not match " |
- "IllegalJSRegExpException"); |
+ "IllegalJSRegExpException."); |
}); |
test('throwsIndexOutOfRangeException', () { |
@@ -123,7 +123,7 @@ |
throwsIndexOutOfRangeException, |
"Expected: throws an exception which matches IndexOutOfRangeException " |
"but: no exception or exception does not match " |
- "IndexOutOfRangeException"); |
+ "IndexOutOfRangeException."); |
}); |
test('throwsNoSuchMethodException', () { |
@@ -133,7 +133,7 @@ |
throwsNoSuchMethodException, |
"Expected: throws an exception which matches NoSuchMethodException " |
"but: no exception or exception does not match " |
- "NoSuchMethodException"); |
+ "NoSuchMethodException."); |
}); |
test('throwsNotImplementedException', () { |
@@ -143,7 +143,7 @@ |
throwsNotImplementedException, |
"Expected: throws an exception which matches NotImplementedException " |
"but: no exception or exception does not match " |
- "NotImplementedException"); |
+ "NotImplementedException."); |
}); |
test('throwsNullPointerException', () { |
@@ -153,7 +153,7 @@ |
throwsNullPointerException, |
"Expected: throws an exception which matches NullPointerException " |
"but: no exception or exception does not match " |
- "NullPointerException"); |
+ "NullPointerException."); |
}); |
test('throwsUnsupportedOperationException', () { |
@@ -164,13 +164,13 @@ |
"Expected: throws an exception which matches " |
"UnsupportedOperationException " |
"but: no exception or exception does not match " |
- "UnsupportedOperationException"); |
+ "UnsupportedOperationException."); |
}); |
test('returnsNormally', () { |
shouldPass(doesNotThrow, returnsNormally); |
shouldFail(doesThrow, returnsNormally, |
- "Expected: return normally but: threw exception"); |
+ "Expected: return normally but: threw exception."); |
}); |
test('hasLength', () { |
@@ -181,18 +181,18 @@ |
shouldPass('a', hasLength(1)); |
shouldFail(0, hasLength(0), new PrefixMatcher( |
"Expected: an object with length of <0> " |
- "but: was <0> has no length property")); |
+ "but: was <0> has no length property.")); |
b.add(0); |
shouldPass(b, hasLength(1)); |
shouldFail(b, hasLength(2), |
"Expected: an object with length of <2> " |
- "but: was <[0]> with length of <1>"); |
+ "but: was <[0]> with length of <1>."); |
b.add(0); |
shouldFail(b, hasLength(1), |
"Expected: an object with length of <1> " |
- "but: was <[0, 0]> with length of <2>"); |
+ "but: was <[0, 0]> with length of <2>."); |
shouldPass(b, hasLength(2)); |
}); |
}); |
@@ -202,64 +202,64 @@ |
test('greaterThan', () { |
shouldPass(10, greaterThan(9)); |
shouldFail(9, greaterThan(10), |
- "Expected: a value greater than <10> but: was <9>"); |
+ "Expected: a value greater than <10> but: was <9>."); |
}); |
test('greaterThanOrEqualTo', () { |
shouldPass(10, greaterThanOrEqualTo(10)); |
shouldFail(9, greaterThanOrEqualTo(10), |
- "Expected: a value greater than or equal to <10> but: was <9>"); |
+ "Expected: a value greater than or equal to <10> but: was <9>."); |
}); |
test('lessThan', () { |
shouldFail(10, lessThan(9), "Expected: a value less than <9> " |
- "but: was <10>"); |
+ "but: was <10>."); |
shouldPass(9, lessThan(10)); |
}); |
test('lessThanOrEqualTo', () { |
shouldPass(10, lessThanOrEqualTo(10)); |
shouldFail(11, lessThanOrEqualTo(10), |
- "Expected: a value less than or equal to <10> but: was <11>"); |
+ "Expected: a value less than or equal to <10> but: was <11>."); |
}); |
test('isZero', () { |
shouldPass(0, isZero); |
- shouldFail(1, isZero, "Expected: a value equal to <0> but: was <1>"); |
+ shouldFail(1, isZero, "Expected: a value equal to <0> but: was <1>."); |
}); |
test('isNonZero', () { |
shouldFail(0, isNonZero, "Expected: a value not equal to <0> " |
- "but: was <0>"); |
+ "but: was <0>."); |
shouldPass(1, isNonZero); |
}); |
test('isPositive', () { |
shouldFail(-1, isPositive, "Expected: a positive value " |
- "but: was <-1>"); |
+ "but: was <-1>."); |
shouldFail(0, isPositive, "Expected: a positive value " |
- "but: was <0>"); |
+ "but: was <0>."); |
shouldPass(1, isPositive); |
}); |
test('isNegative', () { |
shouldPass(-1, isNegative); |
shouldFail(0, isNegative, |
- "Expected: a negative value but: was <0>"); |
+ "Expected: a negative value but: was <0>."); |
}); |
test('isNonPositive', () { |
shouldPass(-1, isNonPositive); |
shouldPass(0, isNonPositive); |
shouldFail(1, isNonPositive, |
- "Expected: a non-positive value but: was <1>"); |
+ "Expected: a non-positive value but: was <1>."); |
}); |
test('isNonNegative', () { |
shouldPass(1, isNonNegative); |
shouldPass(0, isNonNegative); |
shouldFail(-1, isNonNegative, |
- "Expected: a non-negative value but: was <-1>"); |
+ "Expected: a non-negative value but: was <-1>."); |
}); |
test('closeTo', () { |
@@ -268,38 +268,38 @@ |
shouldPass(1, closeTo(0, 1)); |
shouldFail(1.001, closeTo(0, 1), |
"Expected: a numeric value within <1> of <0> " |
- "but: <1.001> differed by <1.001>"); |
+ "but: <1.001> differed by <1.001>."); |
shouldFail(-1.001, closeTo(0, 1), |
"Expected: a numeric value within <1> of <0> " |
- "but: <-1.001> differed by <1.001>"); |
+ "but: <-1.001> differed by <1.001>."); |
}); |
test('inInclusiveRange', () { |
shouldFail(-1, inInclusiveRange(0,2), |
"Expected: be in range from 0 (inclusive) to 2 (inclusive) " |
- "but: was <-1>"); |
+ "but: was <-1>."); |
shouldPass(0, inInclusiveRange(0,2)); |
shouldPass(1, inInclusiveRange(0,2)); |
shouldPass(2, inInclusiveRange(0,2)); |
shouldFail(3, inInclusiveRange(0,2), |
"Expected: be in range from 0 (inclusive) to 2 (inclusive) " |
- "but: was <3>"); |
+ "but: was <3>."); |
}); |
test('inExclusiveRange', () { |
shouldFail(0, inExclusiveRange(0,2), |
"Expected: be in range from 0 (exclusive) to 2 (exclusive) " |
- "but: was <0>"); |
+ "but: was <0>."); |
shouldPass(1, inExclusiveRange(0,2)); |
shouldFail(2, inExclusiveRange(0,2), |
"Expected: be in range from 0 (exclusive) to 2 (exclusive) " |
- "but: was <2>"); |
+ "but: was <2>."); |
}); |
test('inOpenClosedRange', () { |
shouldFail(0, inOpenClosedRange(0,2), |
"Expected: be in range from 0 (exclusive) to 2 (inclusive) " |
- "but: was <0>"); |
+ "but: was <0>."); |
shouldPass(1, inOpenClosedRange(0,2)); |
shouldPass(2, inOpenClosedRange(0,2)); |
}); |
@@ -309,7 +309,7 @@ |
shouldPass(1, inClosedOpenRange(0,2)); |
shouldFail(2, inClosedOpenRange(0,2), |
"Expected: be in range from 0 (inclusive) to 2 (exclusive) " |
- "but: was <2>"); |
+ "but: was <2>."); |
}); |
}); |
@@ -318,22 +318,22 @@ |
test('isEmpty', () { |
shouldPass('', isEmpty); |
shouldFail(null, isEmpty, |
- "Expected: empty but: was <null>"); |
+ "Expected: empty but: was <null>."); |
shouldFail(0, isEmpty, |
- "Expected: empty but: was <0>"); |
- shouldFail('a', isEmpty, "Expected: empty but: was 'a'"); |
+ "Expected: empty but: was <0>."); |
+ shouldFail('a', isEmpty, "Expected: empty but: was 'a'."); |
}); |
test('equalsIgnoringCase', () { |
shouldPass('hello', equalsIgnoringCase('HELLO')); |
shouldFail('hi', equalsIgnoringCase('HELLO'), |
- "Expected: 'HELLO' ignoring case but: was 'hi'"); |
+ "Expected: 'HELLO' ignoring case but: was 'hi'."); |
}); |
test('equalsIgnoringWhitespace', () { |
shouldPass(' hello world ', equalsIgnoringWhitespace('hello world')); |
shouldFail(' helloworld ', equalsIgnoringWhitespace('hello world'), |
- "Expected: 'hello world' ignoring whitespace but: was 'helloworld'"); |
+ "Expected: 'hello world' ignoring whitespace but: was 'helloworld'."); |
}); |
test('startsWith', () { |
@@ -341,7 +341,7 @@ |
shouldPass('hello', startsWith('hell')); |
shouldPass('hello', startsWith('hello')); |
shouldFail('hello', startsWith('hello '), |
- "Expected: a string starting with 'hello ' but: was 'hello'"); |
+ "Expected: a string starting with 'hello ' but: was 'hello'."); |
}); |
test('endsWith', () { |
@@ -349,7 +349,7 @@ |
shouldPass('hello', endsWith('lo')); |
shouldPass('hello', endsWith('hello')); |
shouldFail('hello', endsWith(' hello'), |
- "Expected: a string ending with ' hello' but: was 'hello'"); |
+ "Expected: a string ending with ' hello' but: was 'hello'."); |
}); |
test('contains', () { |
@@ -359,7 +359,7 @@ |
shouldPass('hello', contains('hell')); |
shouldPass('hello', contains('hello')); |
shouldFail('hello', contains(' '), |
- "Expected: contains ' ' but: was 'hello'"); |
+ "Expected: contains ' ' but: was 'hello'."); |
}); |
test('stringContainsInOrder', () { |
@@ -378,14 +378,14 @@ |
shouldFail('goodbye cruel world', |
stringContainsInOrder(['goo', 'cruel', 'bye']), |
"Expected: a string containing 'goo', 'cruel', 'bye' in order " |
- "but: was 'goodbye cruel world'"); |
+ "but: was 'goodbye cruel world'."); |
}); |
test('matches', () { |
shouldPass('c0d', matches('[a-z][0-9][a-z]')); |
shouldPass('c0d', matches(new RegExp('[a-z][0-9][a-z]'))); |
shouldFail('cOd', matches('[a-z][0-9][a-z]'), |
- "Expected: match '[a-z][0-9][a-z]' but: was 'cOd'"); |
+ "Expected: match '[a-z][0-9][a-z]' but: was 'cOd'."); |
}); |
}); |
@@ -393,26 +393,26 @@ |
test('isEmpty', () { |
shouldPass([], isEmpty); |
- shouldFail([1], isEmpty, "Expected: empty but: was <[1]>"); |
+ shouldFail([1], isEmpty, "Expected: empty but: was <[1]>."); |
}); |
test('contains', () { |
var d = [1, 2]; |
shouldPass(d, contains(1)); |
- shouldFail(d, contains(0), "Expected: contains <0> but: was <[1, 2]>"); |
+ shouldFail(d, contains(0), "Expected: contains <0> but: was <[1, 2]>."); |
}); |
test('isIn', () { |
var d = [1, 2]; |
shouldPass(1, isIn(d)); |
- shouldFail(0, isIn(d), "Expected: is in <[1, 2]> but: was <0>"); |
+ shouldFail(0, isIn(d), "Expected: is in <[1, 2]> but: was <0>."); |
}); |
test('everyElement', () { |
var d = [1, 2]; |
var e = [1, 1, 1]; |
shouldFail(d, everyElement(1), |
- "Expected: every element <1> but: was <[1, 2]>"); |
+ "Expected: every element <1> but: was <[1, 2]>."); |
shouldPass(e, everyElement(1)); |
}); |
@@ -421,7 +421,7 @@ |
var e = [1, 1, 1]; |
shouldPass(d, someElement(2)); |
shouldFail(e, someElement(2), |
- "Expected: some element <2> but: was <[1, 1, 1]>"); |
+ "Expected: some element <2> but: was <[1, 1, 1]>."); |
}); |
test('orderedEquals', () { |
@@ -430,7 +430,7 @@ |
shouldPass(d, orderedEquals([1, 2])); |
shouldFail(d, orderedEquals([2, 1]), |
"Expected: equals <[2, 1]> ordered " |
- "but: was <1> mismatch at position 0"); |
+ "but: was <1> mismatch at position 0."); |
}); |
test('unorderedEquals', () { |
@@ -438,13 +438,13 @@ |
shouldPass(d, unorderedEquals([2, 1])); |
shouldFail(d, unorderedEquals([1]), |
"Expected: equals <[1]> unordered " |
- "but: has too many elements (2 > 1)"); |
+ "but: has too many elements (2 > 1)."); |
shouldFail(d, unorderedEquals([3, 2, 1]), |
"Expected: equals <[3, 2, 1]> unordered " |
- "but: has too few elements (2 < 3)"); |
+ "but: has too few elements (2 < 3)."); |
shouldFail(d, unorderedEquals([3, 1]), |
"Expected: equals <[3, 1]> unordered " |
- "but: has no match for element <3> at position 0"); |
+ "but: has no match for element <3> at position 0."); |
}); |
}); |
@@ -455,7 +455,7 @@ |
shouldPass({}, isEmpty); |
shouldPass(a, isEmpty); |
a['foo'] = 'bar'; |
- shouldFail(a, isEmpty, "Expected: empty but: was <{foo: bar}>"); |
+ shouldFail(a, isEmpty, "Expected: empty but: was <{foo: bar}>."); |
}); |
test('contains', () { |
@@ -464,9 +464,9 @@ |
var b = new Map(); |
shouldPass(a, contains('foo')); |
shouldFail(b, contains('foo'), |
- "Expected: contains 'foo' but: was <{}>"); |
+ "Expected: contains 'foo' but: was <{}>."); |
shouldFail(10, contains('foo'), |
- "Expected: contains 'foo' but: was <10>"); |
+ "Expected: contains 'foo' but: was <10>."); |
}); |
test('containsValue', () { |
@@ -474,7 +474,7 @@ |
a['foo'] = 'bar'; |
shouldPass(a, containsValue('bar')); |
shouldFail(a, containsValue('ba'), |
- "Expected: contains value 'ba' but: was <{foo: bar}>"); |
+ "Expected: contains value 'ba' but: was <{foo: bar}>."); |
}); |
test('containsPair', () { |
@@ -483,10 +483,10 @@ |
shouldPass(a, containsPair('foo', 'bar')); |
shouldFail(a, containsPair('foo', 'ba'), |
"Expected: contains pair 'foo' => 'ba' " |
- "but: contains key 'foo' but with value was 'bar'"); |
+ "but: contains key 'foo' but with value was 'bar'."); |
shouldFail(a, containsPair('fo', 'bar'), |
"Expected: contains pair 'fo' => 'bar' " |
- "but: <{foo: bar}> doesn't contain key 'fo'"); |
+ "but: <{foo: bar}> doesn't contain key 'fo'."); |
}); |
test('hasLength', () { |
@@ -496,7 +496,7 @@ |
shouldPass(a, hasLength(1)); |
shouldFail(b, hasLength(1), |
"Expected: an object with length of <1> " |
- "but: was <{}> with length of <0>"); |
+ "but: was <{}> with length of <0>."); |
}); |
}); |
@@ -504,7 +504,7 @@ |
test('anyOf', () { |
shouldFail(0, anyOf([equals(1), equals(2)]), |
- "Expected: (<1> or <2>) but: was <0>"); |
+ "Expected: (<1> or <2>) but: was <0>."); |
shouldPass(1, anyOf([equals(1), equals(2)])); |
}); |
@@ -512,14 +512,14 @@ |
shouldPass(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>) " |
- "but: a value greater than <0> was <-1>"); |
+ "but: a value greater than <0> was <-1>."); |
}); |
}); |
group('Predicate Matchers', () { |
test('isInstanceOf', () { |
shouldFail(0, predicate((x) => x is String, "an instance of String"), |
- "Expected: an instance of String but: was <0>"); |
+ "Expected: an instance of String but: was <0>."); |
shouldPass('cow', predicate((x) => x is String, "an instance of String")); |
}); |
}); |