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

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

Issue 12473003: Remove deprecated StringBuffer.add, addAll and addCharCode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
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 class ToStringWrapper { 8 class ToStringWrapper {
9 final value; 9 final value;
10 10
(...skipping 23 matching lines...) Expand all
34 } 34 }
35 } 35 }
36 Expect.isTrue(result is String); 36 Expect.isTrue(result is String);
37 return 'Success'; 37 return 'Success';
38 } 38 }
39 39
40 buffer(object) { 40 buffer(object) {
41 var sb; 41 var sb;
42 if (checkedMode && object != null) { 42 if (checkedMode && object != null) {
43 try { 43 try {
44 sb = new StringBuffer().add(wrap(object)); 44 sb = new StringBuffer()..write(wrap(object));
45 } on TypeError { 45 } on TypeError {
46 return 'Error'; 46 return 'Error';
47 } 47 }
48 } else { 48 } else {
49 try { 49 try {
50 sb = new StringBuffer().add(wrap(object)); 50 sb = new StringBuffer()..write(wrap(object));
51 } on ArgumentError { 51 } on ArgumentError {
52 return 'Error'; 52 return 'Error';
53 } 53 }
54 Expect.isTrue(sb.toString() is String); 54 Expect.isTrue(sb.toString() is String);
55 } 55 }
56 return 'Success'; 56 return 'Success';
57 } 57 }
58 58
59 initBuffer(object) { 59 initBuffer(object) {
60 var sb; 60 var sb;
(...skipping 28 matching lines...) Expand all
89 Expect.equals('Error', buffer([1])); 89 Expect.equals('Error', buffer([1]));
90 Expect.equals('Error', buffer(new Object())); 90 Expect.equals('Error', buffer(new Object()));
91 91
92 Expect.equals('Error', initBuffer(null)); 92 Expect.equals('Error', initBuffer(null));
93 Expect.equals('Success', initBuffer("")); 93 Expect.equals('Success', initBuffer(""));
94 Expect.equals('Success', initBuffer("string")); 94 Expect.equals('Success', initBuffer("string"));
95 Expect.equals('Error', initBuffer([])); 95 Expect.equals('Error', initBuffer([]));
96 Expect.equals('Error', initBuffer([1])); 96 Expect.equals('Error', initBuffer([1]));
97 Expect.equals('Error', initBuffer(new Object())); 97 Expect.equals('Error', initBuffer(new Object()));
98 } 98 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698