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

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: Fixed typos. Created 7 years, 10 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 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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698