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

Unified Diff: pkg/analyzer_plugin/test/src/utilities/string_utilities_test.dart

Issue 2875323002: Remove unintentional dependency on analysis_server (Closed)
Patch Set: Created 3 years, 7 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: pkg/analyzer_plugin/test/src/utilities/string_utilities_test.dart
diff --git a/pkg/analyzer_plugin/test/src/utilities/string_utilities_test.dart b/pkg/analyzer_plugin/test/src/utilities/string_utilities_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..6bc535055cb93336058839b4432a1396e802fcb7
--- /dev/null
+++ b/pkg/analyzer_plugin/test/src/utilities/string_utilities_test.dart
@@ -0,0 +1,59 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer_plugin/src/utilities/string_utilities.dart';
+import 'package:test/test.dart' hide isEmpty;
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(StringUtilitiesTest);
+ });
+}
+
+@reflectiveTest
+class StringUtilitiesTest {
+ void test_getCamelWords() {
+ expect(getCamelWords(null), []);
+ expect(getCamelWords(''), []);
+ expect(getCamelWords('getCamelWords'), ['get', 'Camel', 'Words']);
+ expect(getCamelWords('getHTMLText'), ['get', 'HTML', 'Text']);
+ }
+
+ void test_isEmpty() {
+ expect(isEmpty(null), isTrue);
+ expect(isEmpty(''), isTrue);
+ expect(isEmpty('X'), isFalse);
+ expect(isEmpty(' '), isFalse);
+ }
+
+ void test_isLowerCase() {
+ for (int c in 'abcdefghijklmnopqrstuvwxyz'.codeUnits) {
+ expect(isLowerCase(c), isTrue);
+ }
+ for (int c in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.codeUnits) {
+ expect(isLowerCase(c), isFalse);
+ }
+ expect(isLowerCase(' '.codeUnitAt(0)), isFalse);
+ expect(isLowerCase('0'.codeUnitAt(0)), isFalse);
+ }
+
+ void test_isUpperCase() {
+ for (int c in 'abcdefghijklmnopqrstuvwxyz'.codeUnits) {
+ expect(isUpperCase(c), isFalse);
+ }
+ for (int c in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.codeUnits) {
+ expect(isUpperCase(c), isTrue);
+ }
+ expect(isUpperCase(' '.codeUnitAt(0)), isFalse);
+ expect(isUpperCase('0'.codeUnitAt(0)), isFalse);
+ }
+
+ void test_removeStart() {
+ expect(removeStart(null, 'x'), null);
+ expect(removeStart('abc', null), 'abc');
+ expect(removeStart('abcTest', 'abc'), 'Test');
+ expect(removeStart('my abcTest', 'abc'), 'my abcTest');
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698