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

Side by Side Diff: tests/language/string_interpolation_and_buffer_test.dart

Issue 2771453003: Format all tests. (Closed)
Patch Set: Format files Created 3 years, 8 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
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 // Test to ensure that StringBuffer and string interpolation behaves 5 // Test to ensure that StringBuffer and string interpolation behaves
6 // the same and fail fast. 6 // the same and fail fast.
7 7
8 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
9 9
10 class ToStringWrapper { 10 class ToStringWrapper {
(...skipping 19 matching lines...) Expand all
30 30
31 main() { 31 main() {
32 interpolate(object) { 32 interpolate(object) {
33 var result; 33 var result;
34 if (checkedMode && object != null) { 34 if (checkedMode && object != null) {
35 try { 35 try {
36 result = '${wrap(object)}'; 36 result = '${wrap(object)}';
37 } on TypeError { 37 } on TypeError {
38 return 'Error'; 38 return 'Error';
39 } on ArgumentError { 39 } on ArgumentError {
40 return 'Error'; // Checked mode. 40 return 'Error'; // Checked mode.
41 } 41 }
42 } else { 42 } else {
43 try { 43 try {
44 result = '${wrap(object)}'; 44 result = '${wrap(object)}';
45 } on ArgumentError { 45 } on ArgumentError {
46 return 'Error'; 46 return 'Error';
47 } 47 }
48 } 48 }
49 Expect.isTrue(result is String); 49 Expect.isTrue(result is String);
50 return 'Success'; 50 return 'Success';
51 } 51 }
52 52
53 buffer(object) { 53 buffer(object) {
54 var sb; 54 var sb;
55 if (checkedMode && object != null) { 55 if (checkedMode && object != null) {
56 try { 56 try {
57 sb = new StringBuffer()..write(wrap(object)); 57 sb = new StringBuffer()..write(wrap(object));
58 } on TypeError { 58 } on TypeError {
59 return 'Error'; 59 return 'Error';
60 } on ArgumentError { 60 } on ArgumentError {
61 return 'Error'; // Checked mode. 61 return 'Error'; // Checked mode.
62 } 62 }
63 } else { 63 } else {
64 try { 64 try {
65 sb = new StringBuffer()..write(wrap(object)); 65 sb = new StringBuffer()..write(wrap(object));
66 } on ArgumentError { 66 } on ArgumentError {
67 return 'Error'; 67 return 'Error';
68 } 68 }
69 Expect.isTrue(sb.toString() is String); 69 Expect.isTrue(sb.toString() is String);
70 } 70 }
71 return 'Success'; 71 return 'Success';
72 } 72 }
73 73
74 initBuffer(object) { 74 initBuffer(object) {
75 var sb; 75 var sb;
76 if (checkedMode && object != null) { 76 if (checkedMode && object != null) {
77 try { 77 try {
78 sb = new StringBuffer(wrap(object)); 78 sb = new StringBuffer(wrap(object));
79 } on TypeError { 79 } on TypeError {
80 return 'Error'; 80 return 'Error';
81 } on ArgumentError { 81 } on ArgumentError {
82 return 'Error'; // Checked mode. 82 return 'Error'; // Checked mode.
83 } 83 }
84 } else { 84 } else {
85 try { 85 try {
86 sb = new StringBuffer(wrap(object)); 86 sb = new StringBuffer(wrap(object));
87 } on ArgumentError { 87 } on ArgumentError {
88 return 'Error'; 88 return 'Error';
89 } 89 }
90 Expect.isTrue(sb.toString() is String); 90 Expect.isTrue(sb.toString() is String);
91 } 91 }
92 return 'Success'; 92 return 'Success';
(...skipping 13 matching lines...) Expand all
106 Expect.equals('Error', buffer([1])); 106 Expect.equals('Error', buffer([1]));
107 Expect.equals('Error', buffer(new Object())); 107 Expect.equals('Error', buffer(new Object()));
108 108
109 Expect.equals('Error', initBuffer(null)); 109 Expect.equals('Error', initBuffer(null));
110 Expect.equals('Success', initBuffer("")); 110 Expect.equals('Success', initBuffer(""));
111 Expect.equals('Success', initBuffer("string")); 111 Expect.equals('Success', initBuffer("string"));
112 Expect.equals('Error', initBuffer([])); 112 Expect.equals('Error', initBuffer([]));
113 Expect.equals('Error', initBuffer([1])); 113 Expect.equals('Error', initBuffer([1]));
114 Expect.equals('Error', initBuffer(new Object())); 114 Expect.equals('Error', initBuffer(new Object()));
115 } 115 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698