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

Unified Diff: recipes/test/core/strings/changing_string_case_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 side-by-side diff with in-line comments
Download patch
Index: recipes/test/core/strings/changing_string_case_test.dart
diff --git a/recipes/test/core/strings/changing_string_case_test.dart b/recipes/test/core/strings/changing_string_case_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..2e868f578434ca123283c316f04153909772a211
--- /dev/null
+++ b/recipes/test/core/strings/changing_string_case_test.dart
@@ -0,0 +1,34 @@
+library changing_string_case_test;
+
+import 'package:unittest/unittest.dart';
+
+void main() {
+group('changing string case', () {
+ var theOneILove = 'I love Lucy!';
+
+ test('with toUpperCase()', () {
+ expect(theOneILove.toUpperCase(), equals('I LOVE LUCY!'));
+ });
+
+ test('with toLowerCase()', () {
+ expect(theOneILove.toLowerCase(), equals('i love lucy!'));
+ });
+
+ test('with bicameral characters', () {
+ var zeus = '\u0394\u03af\u03b1\u03c2'; // Δίας
+ var resume = '\u0052\u00e9\u0073\u0075\u006d\u00e9'; // Résumé
+ expect(zeus.toLowerCase(), equals('δίας'));
+ expect(zeus.toUpperCase(), equals('ΔΊΑΣ'));
+ expect(resume.toLowerCase(), equals('résumé'));
+ expect(resume.toUpperCase(), equals('RÉSUMÉ'));
+ });
+
+ test('with unicameral characters', () {
+ var chickenKebab = '\u091a\u093f\u0915\u0928 \u0915\u092c\u093e\u092c';
+ // चिकन कबाब
+ expect(chickenKebab.toLowerCase(), equals(chickenKebab));
+ expect(chickenKebab.toUpperCase(), equals(chickenKebab));
+ });
+ });
+}
+
« no previous file with comments | « recipes/test/core/strings/calculating_the_length_test.dart ('k') | recipes/test/core/strings/concatenating_strings_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698