OLD | NEW |
(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 } |
OLD | NEW |