OLD | NEW |
(Empty) | |
| 1 library incrementally_building; |
| 2 |
| 3 import 'package:unittest/unittest.dart'; |
| 4 |
| 5 void main() { |
| 6 group('incrementally building a string using a StringBuffer', () { |
| 7 test('using write()', () { |
| 8 var sb = new StringBuffer(); |
| 9 sb.write('John, '); |
| 10 sb.write('Paul, '); |
| 11 sb.write('George, '); |
| 12 sb.write('and Ringo'); |
| 13 expect(sb.toString(), equals('John, Paul, George, and Ringo')); |
| 14 }); |
| 15 |
| 16 test('using several methods', () { |
| 17 var sb = new StringBuffer(); |
| 18 sb.writeln('The Beatles:'); |
| 19 sb.writeAll(['John, ', 'Paul, ', 'George, and Ringo']); |
| 20 sb.writeCharCode(33); // charCode for '!'. |
| 21 expect(sb.toString(), equals('The Beatles:\nJohn, Paul, George, and Ringo!
')); |
| 22 }); |
| 23 }); |
| 24 } |
OLD | NEW |