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

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

Issue 12335109: Strings recipes for the Dart Cookbook (Closed) Base URL: https://github.com/dart-lang/cookbook.git@master
Patch Set: Total rewrite of string recipes. 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 calculating_the_length_test;
2
3 import 'package:unittest/unittest.dart';
4
5 void main() {
6 group('calculating the length of a string', () {
7
8 var hearts = '\u2661';
9
10 test('that contains only BMP symbols', () {
11 expect('I love music'.length, equals(12));
12 expect('I love music'.runes.length, equals(12));
13
14 expect(hearts.length, equals(1));
15 expect(hearts.runes.length, equals(1));
16 });
17
18 test('that contains non-BMP symbols', () {
19 var clef = '\u{1F3BC}';
20 expect(clef.length, equals(2));
21 expect(clef.runes.length, equals(1));
22
23 var music = 'I $hearts $clef';
24 expect(music.length, equals(6));
25 expect(music.runes.length, equals(5));
26 });
27 });
28 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698