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

Side by Side Diff: test/string_matchers_test.dart

Issue 891463004: Correctly match and print strings with escaped values (Closed) Base URL: https://github.com/dart-lang/matcher.git@master
Patch Set: also fixed prettyPrint Created 5 years, 10 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
« lib/src/util.dart ('K') | « test/pretty_print_test.dart ('k') | no next file » | 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';
11 11
12 void main() { 12 void main() {
13 initUtils(); 13 initUtils();
14 14
15 test('Report mismatches in whitespace and escape sequences correctly', () {
nweiz 2015/02/06 00:23:14 "Report" -> "Reports"
kevmoo 2015/02/06 02:58:59 Done.
16 shouldFail('\n', equals('\\n'), contains('Differ at offset 1'));
17 });
18
15 test('collapseWhitespace', () { 19 test('collapseWhitespace', () {
16 var source = '\t\r\n hello\t\r\n world\r\t \n'; 20 var source = '\t\r\n hello\t\r\n world\r\t \n';
17 expect(collapseWhitespace(source), 'hello world'); 21 expect(collapseWhitespace(source), 'hello world');
18 }); 22 });
19 23
20 test('isEmpty', () { 24 test('isEmpty', () {
21 shouldPass('', isEmpty); 25 shouldPass('', isEmpty);
22 shouldFail(null, isEmpty, startsWith("Expected: empty Actual: <null>")); 26 shouldFail(null, isEmpty, startsWith("Expected: empty Actual: <null>"));
23 shouldFail(0, isEmpty, startsWith("Expected: empty Actual: <0>")); 27 shouldFail(0, isEmpty, startsWith("Expected: empty Actual: <0>"));
24 shouldFail('a', isEmpty, startsWith("Expected: empty Actual: 'a'")); 28 shouldFail('a', isEmpty, startsWith("Expected: empty Actual: 'a'"));
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 "Actual: 'goodbye cruel world'"); 105 "Actual: 'goodbye cruel world'");
102 }); 106 });
103 107
104 test('matches', () { 108 test('matches', () {
105 shouldPass('c0d', matches('[a-z][0-9][a-z]')); 109 shouldPass('c0d', matches('[a-z][0-9][a-z]'));
106 shouldPass('c0d', matches(new RegExp('[a-z][0-9][a-z]'))); 110 shouldPass('c0d', matches(new RegExp('[a-z][0-9][a-z]')));
107 shouldFail('cOd', matches('[a-z][0-9][a-z]'), 111 shouldFail('cOd', matches('[a-z][0-9][a-z]'),
108 "Expected: match '[a-z][0-9][a-z]' Actual: 'cOd'"); 112 "Expected: match '[a-z][0-9][a-z]' Actual: 'cOd'");
109 }); 113 });
110 } 114 }
OLDNEW
« lib/src/util.dart ('K') | « test/pretty_print_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698