Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Side by Side Diff: test/string_matchers_test.dart

Issue 840133003: matcher: fixed status file, formatting, tweaks to readme (Closed) Base URL: https://github.com/dart-lang/matcher.git@master
Patch Set: nits Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/prints_matcher_test.dart ('k') | test/test_common.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library matcher.string_matchers_test; 5 library matcher.string_matchers_test;
6 6
7 import 'package:matcher/matcher.dart'; 7 import 'package:matcher/matcher.dart';
8 import 'package:unittest/unittest.dart' show test, group; 8 import 'package:unittest/unittest.dart' show test, group;
9 9
10 import 'test_utils.dart'; 10 import 'test_utils.dart';
(...skipping 11 matching lines...) Expand all
22 shouldFail(null, isEmpty, startsWith("Expected: empty Actual: <null>")); 22 shouldFail(null, isEmpty, startsWith("Expected: empty Actual: <null>"));
23 shouldFail(0, isEmpty, startsWith("Expected: empty Actual: <0>")); 23 shouldFail(0, isEmpty, startsWith("Expected: empty Actual: <0>"));
24 shouldFail('a', isEmpty, startsWith("Expected: empty Actual: 'a'")); 24 shouldFail('a', isEmpty, startsWith("Expected: empty Actual: 'a'"));
25 }); 25 });
26 26
27 // Regression test for: https://code.google.com/p/dart/issues/detail?id=21562 27 // Regression test for: https://code.google.com/p/dart/issues/detail?id=21562
28 test('isNot(isEmpty)', () { 28 test('isNot(isEmpty)', () {
29 shouldPass('a', isNot(isEmpty)); 29 shouldPass('a', isNot(isEmpty));
30 shouldFail('', isNot(isEmpty), 'Expected: not empty Actual: \'\''); 30 shouldFail('', isNot(isEmpty), 'Expected: not empty Actual: \'\'');
31 shouldFail(null, isNot(isEmpty), 31 shouldFail(null, isNot(isEmpty),
32 startsWith('Expected: not empty Actual: <null>')); 32 startsWith('Expected: not empty Actual: <null>'));
33 }); 33 });
34 34
35 test('isNotEmpty', () { 35 test('isNotEmpty', () {
36 shouldFail('', isNotEmpty, startsWith("Expected: non-empty Actual: ''")); 36 shouldFail('', isNotEmpty, startsWith("Expected: non-empty Actual: ''"));
37 shouldFail(null, isNotEmpty, 37 shouldFail(
38 startsWith("Expected: non-empty Actual: <null>")); 38 null, isNotEmpty, startsWith("Expected: non-empty Actual: <null>"));
39 shouldFail(0, isNotEmpty, startsWith("Expected: non-empty Actual: <0>")); 39 shouldFail(0, isNotEmpty, startsWith("Expected: non-empty Actual: <0>"));
40 shouldPass('a', isNotEmpty); 40 shouldPass('a', isNotEmpty);
41 }); 41 });
42 42
43 test('equalsIgnoringCase', () { 43 test('equalsIgnoringCase', () {
44 shouldPass('hello', equalsIgnoringCase('HELLO')); 44 shouldPass('hello', equalsIgnoringCase('HELLO'));
45 shouldFail('hi', equalsIgnoringCase('HELLO'), 45 shouldFail('hi', equalsIgnoringCase('HELLO'),
46 "Expected: 'HELLO' ignoring case Actual: 'hi'"); 46 "Expected: 'HELLO' ignoring case Actual: 'hi'");
47 }); 47 });
48 48
(...skipping 22 matching lines...) Expand all
71 "Expected: a string ending with ' hello' " 71 "Expected: a string ending with ' hello' "
72 "Actual: 'hello'"); 72 "Actual: 'hello'");
73 }); 73 });
74 74
75 test('contains', () { 75 test('contains', () {
76 shouldPass('hello', contains('')); 76 shouldPass('hello', contains(''));
77 shouldPass('hello', contains('h')); 77 shouldPass('hello', contains('h'));
78 shouldPass('hello', contains('o')); 78 shouldPass('hello', contains('o'));
79 shouldPass('hello', contains('hell')); 79 shouldPass('hello', contains('hell'));
80 shouldPass('hello', contains('hello')); 80 shouldPass('hello', contains('hello'));
81 shouldFail('hello', contains(' '), 81 shouldFail(
82 "Expected: contains ' ' Actual: 'hello'"); 82 'hello', contains(' '), "Expected: contains ' ' Actual: 'hello'");
83 }); 83 });
84 84
85 test('stringContainsInOrder', () { 85 test('stringContainsInOrder', () {
86 shouldPass('goodbye cruel world', stringContainsInOrder([''])); 86 shouldPass('goodbye cruel world', stringContainsInOrder(['']));
87 shouldPass('goodbye cruel world', stringContainsInOrder(['goodbye'])); 87 shouldPass('goodbye cruel world', stringContainsInOrder(['goodbye']));
88 shouldPass('goodbye cruel world', stringContainsInOrder(['cruel'])); 88 shouldPass('goodbye cruel world', stringContainsInOrder(['cruel']));
89 shouldPass('goodbye cruel world', stringContainsInOrder(['world'])); 89 shouldPass('goodbye cruel world', stringContainsInOrder(['world']));
90 shouldPass(
91 'goodbye cruel world', stringContainsInOrder(['good', 'bye', 'world']));
92 shouldPass(
93 'goodbye cruel world', stringContainsInOrder(['goodbye', 'cruel']));
94 shouldPass(
95 'goodbye cruel world', stringContainsInOrder(['cruel', 'world']));
90 shouldPass('goodbye cruel world', 96 shouldPass('goodbye cruel world',
91 stringContainsInOrder(['good', 'bye', 'world'])); 97 stringContainsInOrder(['goodbye', 'cruel', 'world']));
92 shouldPass('goodbye cruel world',
93 stringContainsInOrder(['goodbye', 'cruel']));
94 shouldPass('goodbye cruel world',
95 stringContainsInOrder(['cruel', 'world']));
96 shouldPass('goodbye cruel world',
97 stringContainsInOrder(['goodbye', 'cruel', 'world']));
98 shouldFail('goodbye cruel world', 98 shouldFail('goodbye cruel world',
99 stringContainsInOrder(['goo', 'cruel', 'bye']), 99 stringContainsInOrder(['goo', 'cruel', 'bye']),
100 "Expected: a string containing 'goo', 'cruel', 'bye' in order " 100 "Expected: a string containing 'goo', 'cruel', 'bye' in order "
101 "Actual: 'goodbye cruel world'"); 101 "Actual: 'goodbye cruel world'");
102 }); 102 });
103 103
104 test('matches', () { 104 test('matches', () {
105 shouldPass('c0d', matches('[a-z][0-9][a-z]')); 105 shouldPass('c0d', matches('[a-z][0-9][a-z]'));
106 shouldPass('c0d', matches(new RegExp('[a-z][0-9][a-z]'))); 106 shouldPass('c0d', matches(new RegExp('[a-z][0-9][a-z]')));
107 shouldFail('cOd', matches('[a-z][0-9][a-z]'), 107 shouldFail('cOd', matches('[a-z][0-9][a-z]'),
108 "Expected: match '[a-z][0-9][a-z]' Actual: 'cOd'"); 108 "Expected: match '[a-z][0-9][a-z]' Actual: 'cOd'");
109 }); 109 });
110 } 110 }
OLDNEW
« no previous file with comments | « test/prints_matcher_test.dart ('k') | test/test_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698