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

Side by Side Diff: recipes/test/core/strings/getting_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: 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 getting_the_length_test;
2
3 import 'package:unittest/unittest.dart';
4
5 void main() {
6 group('getting the length of a string', () {
7 var clef = '\u{1F3BC}';
8 var hearts = '\u2661';
9 var music = 'I $hearts $clef';
10
11 test('that contains only BMP symbols', () {
12 expect('I love music'.length, equals(12));
13 expect(hearts.length, equals(1));
14 expect(hearts.runes.length, equals(1));
15 });
16
17 test('that contains non-BMP symbols', () {
18 expect(clef.length, equals(2));
19 expect(clef.runes.length, equals(1));
20 expect(music.length, equals(6));
21 expect(music.runes.length, equals(5));
22 });
23 });
24 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698