Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Side by Side Diff: recipes/test/core/strings/concatenating_strings_test.dart

Issue 12335109: Strings recipes for the Dart Cookbook (Closed) Base URL: https://github.com/dart-lang/cookbook.git@master
Patch Set: Made most changes requested my Kathy. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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()', () {
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698