OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 // TODO(srdjan): Move StringBuffer to visible names. | 5 // TODO(srdjan): Move StringBuffer to visible names. |
6 | 6 |
7 class StringBufferTest { | 7 class StringBufferTest { |
8 static testConstructor() { | 8 static testConstructor() { |
9 StringBuffer bf = new StringBuffer(""); | 9 StringBuffer bf = new StringBuffer(""); |
10 Expect.equals(true, bf.isEmpty()); | 10 Expect.equals(true, bf.isEmpty()); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 bf.add("s"); | 46 bf.add("s"); |
47 bf.add("t"); | 47 bf.add("t"); |
48 bf.add("u"); | 48 bf.add("u"); |
49 bf.add("v"); | 49 bf.add("v"); |
50 bf.add("w"); | 50 bf.add("w"); |
51 bf.add("x"); | 51 bf.add("x"); |
52 bf.add("y"); | 52 bf.add("y"); |
53 bf.add("z"); | 53 bf.add("z"); |
54 bf.add("\n"); | 54 bf.add("\n"); |
55 bf.add("thequickbrownfoxjumpsoverthelazydog"); | 55 bf.add("thequickbrownfoxjumpsoverthelazydog"); |
56 Expect.equals("abcdefghijklmnopqrstuvwxyz\n" + | 56 Expect.equals("abcdefghijklmnopqrstuvwxyz\n" |
57 "thequickbrownfoxjumpsoverthelazydog", | 57 "thequickbrownfoxjumpsoverthelazydog", |
58 bf.toString()); | 58 bf.toString()); |
59 | 59 |
60 bf = new StringBuffer(""); | 60 bf = new StringBuffer(""); |
61 for (int i = 0; i < 100000; i++) { | 61 for (int i = 0; i < 100000; i++) { |
62 bf.add(''); | 62 bf.add(''); |
63 bf.add(""); | 63 bf.add(""); |
64 } | 64 } |
65 Expect.equals("", bf.toString()); | 65 Expect.equals("", bf.toString()); |
66 | 66 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 testAdd(); | 148 testAdd(); |
149 testAddAll(); | 149 testAddAll(); |
150 testClear(); | 150 testClear(); |
151 testChaining(); | 151 testChaining(); |
152 } | 152 } |
153 } | 153 } |
154 | 154 |
155 main() { | 155 main() { |
156 StringBufferTest.testMain(); | 156 StringBufferTest.testMain(); |
157 } | 157 } |
OLD | NEW |