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

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: 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 calculating_the_length_test;
2
3 import 'package:unittest/unittest.dart';
4
5 print(obj) {
6 return obj;
7 }
8
9 void main() {
10 group('calculating the length of a string', () {
11
12 var hearts = '\u2661';
13
14 test('that contains only BMP symbols', () {
15 expect('I love music'.length, equals(12));
16 expect('I love music'.runes.length, equals(12));
17
18 expect(hearts.length, equals(1));
19 expect(hearts.runes.length, equals(1));
20 });
21
22 test('that contains non-BMP symbols', () {
23 var clef = '\u{1F3BC}';
24 expect(clef.length, equals(2));
25 expect(clef.runes.length, equals(1));
26
27 var music = 'I $hearts $clef';
28 expect(music.length, equals(6));
29 expect(music.runes.length, equals(5));
30 });
31
32 test('that has superimposed characters', () {
33 var name = 'Ameli\u00E9'; // 'AmeliƩ'
34 var anotherName = 'Ameli\u0065\u0301'; // 'AmeliƩ'
35 expect(print(name.length), equals(6));
36 expect(print(anotherName.length), equals(7));
37 });
38 });
39 }
OLDNEW
« no previous file with comments | « recipes/test/core/core_test.dart ('k') | recipes/test/core/strings/changing_string_case_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698