OLD | NEW |
(Empty) | |
| 1 library concatenating_strings_test; |
| 2 |
| 3 import 'package:unittest/unittest.dart'; |
| 4 |
| 5 void main() { |
| 6 group('concatenating strings', () { |
| 7 group('using adjacent string literals', () { |
| 8 var string = 'Dart is fun!'; |
| 9 |
| 10 test('on one line', () { |
| 11 expect('Dart' ' is' ' fun!', equals(string)); |
| 12 }); |
| 13 |
| 14 test('over many lines', () { |
| 15 expect('Dart' |
| 16 ' is' |
| 17 ' fun!', equals(string)); |
| 18 }); |
| 19 |
| 20 test('over one or many lines', () { |
| 21 expect('Dart' ' is' |
| 22 ' fun!', equals(string)); |
| 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('Peanut ' 'butter' |
| 34 ''' and |
| 35 jelly''', equals('Peanut butter and\njelly')); |
| 36 }); |
| 37 }); |
| 38 |
| 39 group('using alternatives to string literals', () { |
| 40 var string = "Dewey Cheatem and Howe"; |
| 41 |
| 42 test(': concat()', () { |
| 43 expect('Dewey'.concat(' Cheatem').concat(' and').concat( ' Howe'), equal
s(string)); |
| 44 }); |
| 45 |
| 46 test(': join()', () { |
| 47 expect(['Dewey', 'Cheatem', 'and', 'Howe'].join(' '), equals(string)); |
| 48 }); |
| 49 }); |
| 50 }); |
| 51 } |
OLD | NEW |