Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 library concatenating_strings_test; | |
| 2 | |
| 3 import 'package:unittest/unittest.dart'; | |
| 4 | |
| 5 String filmToWatch() => 'The Big Lebowski'; | |
| 6 | |
| 7 void main() { | |
| 8 group('concatenating strings', () { | |
| 9 group('using adjacent string literals', () { | |
| 10 test('on one line', () { | |
| 11 expect('Dart' ' is' ' fun!', equals('Dart is fun!')); | |
| 12 }); | |
| 13 | |
| 14 test('over many lines', () { | |
| 15 expect('Dart' | |
| 16 ' is' | |
| 17 ' fun!', equals('Dart is fun!')); | |
| 18 }); | |
| 19 | |
| 20 test('over one or many lines', () { | |
| 21 expect('Dart' ' is' | |
| 22 ' fun!', equals('Dart is fun!')); | |
| 23 }); | |
| 24 | |
| 25 test('using multiline strings', () { | |
| 26 expect('''Peanut | |
| 27 butter ''' | |
| 28 '''and | |
| 29 jelly''', equals('Peanut\nbutter and\njelly')); | |
| 30 }); | |
| 31 | |
| 32 test('combining single and multiline string', () { | |
| 33 expect('Dewey ' 'Cheatem' | |
| 34 ''' and | |
| 35 Howe''', equals('Dewey Cheatem and\nHowe')); | |
| 36 }); | |
| 37 }); | |
| 38 | |
| 39 group('using alternatives to string literals', () { | |
| 40 test(': concat()', () { | |
|
Lasse Reichstein Nielsen
2013/03/12 11:29:37
We're renaming concat to operator+.
| |
| 41 var film = filmToWatch(); | |
| 42 film = film.concat('\n'); | |
| 43 expect(film, equals('The Big Lebowski\n')); | |
| 44 }); | |
| 45 | |
| 46 test(': join()', () { | |
| 47 expect(['The', 'Big', 'Lebowski'].join(' '), equals('The Big Lebowski')) ; | |
| 48 }); | |
| 49 }); | |
| 50 }); | |
| 51 } | |
| OLD | NEW |