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

Unified Diff: tests/corelib/string_case_test.dart

Issue 213293002: Optimize one-byte string's toUpperCase. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed bug. Added test. Found almost all browsers failing the test. Created 6 years, 8 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
« runtime/lib/string_patch.dart ('K') | « tests/corelib/corelib.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/corelib/string_case_test.dart
diff --git a/tests/corelib/string_case_test.dart b/tests/corelib/string_case_test.dart
index 6ba535ca10ad68d525fac426c9d6fcf096ff6a3a..6ed4890a3df337d1e2d8417362d69cc8c6d3334f 100644
--- a/tests/corelib/string_case_test.dart
+++ b/tests/corelib/string_case_test.dart
@@ -4,21 +4,35 @@
import "package:expect/expect.dart";
-class StringCaseTest {
-
- static testMain() {
- testLowerUpper();
- }
+main() {
+ testLowerUpper();
+ testSpecialCases();
+}
- static testLowerUpper() {
- var a = "Stop! Smell the Roses.";
- var allLower = "stop! smell the roses.";
- var allUpper = "STOP! SMELL THE ROSES.";
- Expect.equals(allUpper, a.toUpperCase());
- Expect.equals(allLower, a.toLowerCase());
- }
+void testLowerUpper() {
+ var a = "Stop! Smell the Roses.";
+ var allLower = "stop! smell the roses.";
+ var allUpper = "STOP! SMELL THE ROSES.";
+ Expect.equals(allUpper, a.toUpperCase());
+ Expect.equals(allLower, a.toLowerCase());
}
-main() {
- StringCaseTest.testMain();
+void testSpecialCases() {
+ // Letters in Latin-1 where the upper case is not in Latin-1.
+
+ // Small letter y diaresis.
+ Expect.equals("\u0178", "\xff".toUpperCase()); /// 03: ok
+ Expect.equals("\xff", "\xff".toLowerCase());
+ Expect.equals("\xff", "\xff".toUpperCase().toLowerCase()); /// 03: continued
+ // German sharp s. Upper case variant is "SS".
+ Expect.equals("SS", "\xdf".toUpperCase()); /// 01: ok
+ Expect.equals("\xdf", "\xdf".toLowerCase());
+ Expect.equals("ss", "\xdf".toUpperCase().toLowerCase()); /// 01: continued
+ // Micro sign (not same as lower-case Greek letter mu, U+03BC).
+ Expect.equals("\u039c", "\xb5".toUpperCase()); /// 02: ok
+ Expect.equals("\xb5", "\xb5".toLowerCase());
+ Expect.equals("\u03Bc", "\xb5".toUpperCase().toLowerCase()); /// 02: continued
Anders Johnsen 2014/04/07 11:43:43 Long line.
Lasse Reichstein Nielsen 2014/04/07 12:12:13 Done.
+ // Zero.
Anders Johnsen 2014/04/07 11:43:43 Do you have a test that would have spotted the 0xf
Lasse Reichstein Nielsen 2014/04/07 12:12:13 It should be detected by the "\xff".toUpperCase()
+ Expect.equals("\x00", "\x00".toLowerCase());
+ Expect.equals("\x00", "\x00".toUpperCase());
}
« runtime/lib/string_patch.dart ('K') | « tests/corelib/corelib.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698