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

Side by Side Diff: recipes/test/core/strings/subscripting_a_string_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 subscripting_a_string_test;
2
3 import 'package:unittest/unittest.dart';
4
5 void main() {
6 group('getting the character at a specific index', () {
7 group("with non-BMP symbol", () {
8 test('with non-BMP symbol', () {
9 var coffee = '\u{1F375}';
10 expect(coffee.runes.toList(), equals([127861]));
11 expect(new String.fromCharCode(coffee.runes.first),
12 equals(coffee));
13 // Cannot use coffee[0] directly.
14 expect(coffee.codeUnits.first, equals(55356));
15 expect(coffee.codeUnits.toList()[0], equals(55356));
16 });
17 });
18
19 group('with BMP symbol', () {
20
21 test('with BMP symbols', () {
22 expect('Dart'[0], equals('D'));
23
24 var hearts = '\u2661';
25 expect(hearts[0], equals('\u2661'));
26 });
27 });
28 });
29 }
OLDNEW
« no previous file with comments | « recipes/test/core/strings/strings_test.dart ('k') | recipes/test/core/strings/substituting_strings_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698