| Index: recipes/test/core/strings/concatenating_strings_test.dart
|
| diff --git a/recipes/test/core/strings/concatenating_strings_test.dart b/recipes/test/core/strings/concatenating_strings_test.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8e9e0d9741eae4568b93d173d7e5446a7987387c
|
| --- /dev/null
|
| +++ b/recipes/test/core/strings/concatenating_strings_test.dart
|
| @@ -0,0 +1,51 @@
|
| +library concatenating_strings_test;
|
| +
|
| +import 'package:unittest/unittest.dart';
|
| +
|
| +String filmToWatch() => 'The Big Lebowski';
|
| +
|
| +void main() {
|
| + group('concatenating strings', () {
|
| + group('using adjacent string literals', () {
|
| + test('on one line', () {
|
| + expect('Dart' ' is' ' fun!', equals('Dart is fun!'));
|
| + });
|
| +
|
| + test('over many lines', () {
|
| + expect('Dart'
|
| + ' is'
|
| + ' fun!', equals('Dart is fun!'));
|
| + });
|
| +
|
| + test('over one or many lines', () {
|
| + expect('Dart' ' is'
|
| + ' fun!', equals('Dart is fun!'));
|
| + });
|
| +
|
| + test('using multiline strings', () {
|
| + expect('''Peanut
|
| +butter '''
|
| +'''and
|
| +jelly''', equals('Peanut\nbutter and\njelly'));
|
| + });
|
| +
|
| + test('combining single and multiline string', () {
|
| + expect('Dewey ' 'Cheatem'
|
| + ''' and
|
| +Howe''', equals('Dewey Cheatem and\nHowe'));
|
| + });
|
| + });
|
| +
|
| + group('using alternatives to string literals', () {
|
| + test(': concat()', () {
|
| + var film = filmToWatch();
|
| + film = film.concat('\n');
|
| + expect(film, equals('The Big Lebowski\n'));
|
| + });
|
| +
|
| + test(': join()', () {
|
| + expect(['The', 'Big', 'Lebowski'].join(' '), equals('The Big Lebowski'));
|
| + });
|
| + });
|
| + });
|
| +}
|
|
|