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

Unified Diff: third_party/dart-packages/matcher/matcher/src/util.dart

Issue 1063233004: Teach dart_package to understand the packages/ subdirectory (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase Created 5 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
Index: third_party/dart-packages/matcher/matcher/src/util.dart
diff --git a/third_party/dart-packages/matcher/matcher/src/util.dart b/third_party/dart-packages/matcher/matcher/src/util.dart
deleted file mode 100644
index a99d2dd1f9fcbedc02722b5349216a2dbc1f260c..0000000000000000000000000000000000000000
--- a/third_party/dart-packages/matcher/matcher/src/util.dart
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) 2014, 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.
-
-library matcher.util;
-
-import 'core_matchers.dart';
-import 'interfaces.dart';
-
-/// A [Map] between whitespace characters and their escape sequences.
-const _escapeMap = const {
- '\n': r'\n',
- '\r': r'\r',
- '\f': r'\f',
- '\b': r'\b',
- '\t': r'\t',
- '\v': r'\v',
-};
-
-/// A [RegExp] that matches whitespace characters that should be escaped.
-final _escapeRegExp =
- new RegExp("[${_escapeMap.keys.map(_getHexLiteral).join()}]");
-
-/// Useful utility for nesting match states.
-void addStateInfo(Map matchState, Map values) {
- var innerState = new Map.from(matchState);
- matchState.clear();
- matchState['state'] = innerState;
- matchState.addAll(values);
-}
-
-/// Takes an argument and returns an equivalent [Matcher].
-///
-/// If the argument is already a matcher this does nothing,
-/// else if the argument is a function, it generates a predicate
-/// function matcher, else it generates an equals matcher.
-Matcher wrapMatcher(x) {
- if (x is Matcher) {
- return x;
- } else if (x is Function) {
- return predicate(x);
- } else {
- return equals(x);
- }
-}
-
-/// Returns [str] with all whitespace characters represented as their escape
-/// sequences.
-///
-/// Backslash characters are escaped as `\\`
-String escape(String str) {
- str = str.replaceAll('\\', r'\\');
- return str.replaceAllMapped(_escapeRegExp, (match) {
- return _escapeMap[match[0]];
- });
-}
-
-/// Given single-character string, return the hex-escaped equivalent.
-String _getHexLiteral(String input) {
- int rune = input.runes.single;
- return r'\x' + rune.toRadixString(16).padLeft(2, '0');
-}
« no previous file with comments | « third_party/dart-packages/matcher/matcher/src/throws_matchers.dart ('k') | third_party/dart-packages/path/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698