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

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

Issue 11565034: Improve performance of dart2js StringBuffer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Updated to lib_v2 and private libraries. Created 7 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 | Annotate | Revision Log
« no previous file with comments | « dart/sdk/lib/core/string_buffer.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 // 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 try { 49 try {
50 sb = new StringBuffer().add(wrap(object)); 50 sb = new StringBuffer().add(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) {
60 var sb;
61 if (checkedMode && object != null) {
62 try {
63 sb = new StringBuffer(wrap(object));
64 } on TypeError {
65 return 'Error';
66 }
67 } else {
68 try {
69 sb = new StringBuffer(wrap(object));
70 } on ArgumentError {
71 return 'Error';
72 }
73 Expect.isTrue(sb.toString() is String);
74 }
75 return 'Success';
76 }
77
59 Expect.equals('Error', interpolate(null)); 78 Expect.equals('Error', interpolate(null));
60 Expect.equals('Success', interpolate("")); 79 Expect.equals('Success', interpolate(""));
61 Expect.equals('Success', interpolate("string")); 80 Expect.equals('Success', interpolate("string"));
62 Expect.equals('Error', interpolate([])); 81 Expect.equals('Error', interpolate([]));
63 Expect.equals('Error', interpolate([1])); 82 Expect.equals('Error', interpolate([1]));
64 Expect.equals('Error', interpolate(new Object())); 83 Expect.equals('Error', interpolate(new Object()));
65 84
66 Expect.equals('Error', buffer(null)); 85 Expect.equals('Error', buffer(null));
67 Expect.equals('Success', buffer("")); 86 Expect.equals('Success', buffer(""));
68 Expect.equals('Success', buffer("string")); 87 Expect.equals('Success', buffer("string"));
69 Expect.equals('Error', buffer([])); 88 Expect.equals('Error', buffer([]));
70 Expect.equals('Error', buffer([1])); 89 Expect.equals('Error', buffer([1]));
71 Expect.equals('Error', buffer(new Object())); 90 Expect.equals('Error', buffer(new Object()));
91
92 Expect.equals('Error', initBuffer(null));
93 Expect.equals('Success', initBuffer(""));
94 Expect.equals('Success', initBuffer("string"));
95 Expect.equals('Error', initBuffer([]));
96 Expect.equals('Error', initBuffer([1]));
97 Expect.equals('Error', initBuffer(new Object()));
72 } 98 }
OLDNEW
« no previous file with comments | « dart/sdk/lib/core/string_buffer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698