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

Side by Side Diff: pkg/scheduled_test/lib/src/descriptor/pattern_descriptor.dart

Issue 50413005: Reapply "Remove @deprecated features." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge to head Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/polymer/lib/component_build.dart ('k') | pkg/unittest/lib/src/iterable_matchers.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library descriptor.pattern; 5 library descriptor.pattern;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 9
10 import 'package:path/path.dart' as path; 10 import 'package:path/path.dart' as path;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 /// matching [pattern], then passes each of their names to the [EntityCreator] 42 /// matching [pattern], then passes each of their names to the [EntityCreator]
43 /// and validates the result. If exactly one succeeds, [this] is considered 43 /// and validates the result. If exactly one succeeds, [this] is considered
44 /// valid. 44 /// valid.
45 Future validate([String parent]) => schedule(() => validateNow(parent), 45 Future validate([String parent]) => schedule(() => validateNow(parent),
46 "validating ${describe()}"); 46 "validating ${describe()}");
47 47
48 Future validateNow([String parent]) { 48 Future validateNow([String parent]) {
49 if (parent == null) parent = defaultRoot; 49 if (parent == null) parent = defaultRoot;
50 // TODO(nweiz): make sure this works with symlinks. 50 // TODO(nweiz): make sure this works with symlinks.
51 var matchingEntries = new Directory(parent).listSync() 51 var matchingEntries = new Directory(parent).listSync()
52 .map((entry) => entry is File ? entry.fullPathSync() : entry.path) 52 .map((entry) => entry is File ? entry.resolveSymbolicLinksSync()
53 : entry.path)
53 .where((entry) => fullMatch(path.basename(entry), pattern)) 54 .where((entry) => fullMatch(path.basename(entry), pattern))
54 .toList(); 55 .toList();
55 matchingEntries.sort(); 56 matchingEntries.sort();
56 57
57 if (matchingEntries.isEmpty) { 58 if (matchingEntries.isEmpty) {
58 fail("No entry found in '$parent' matching ${_patternDescription}."); 59 fail("No entry found in '$parent' matching ${_patternDescription}.");
59 } 60 }
60 61
61 return Future.wait(matchingEntries.map((entry) { 62 return Future.wait(matchingEntries.map((entry) {
62 var descriptor = _fn(path.basename(entry)); 63 var descriptor = _fn(path.basename(entry));
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 var regExp = pattern as RegExp; 107 var regExp = pattern as RegExp;
107 var flags = new StringBuffer(); 108 var flags = new StringBuffer();
108 if (!regExp.isCaseSensitive) flags.write('i'); 109 if (!regExp.isCaseSensitive) flags.write('i');
109 if (regExp.isMultiLine) flags.write('m'); 110 if (regExp.isMultiLine) flags.write('m');
110 return '/${regExp.pattern}/$flags'; 111 return '/${regExp.pattern}/$flags';
111 } 112 }
112 113
113 Future create([String parent]) => new Future.error( 114 Future create([String parent]) => new Future.error(
114 new UnsupportedError("Pattern descriptors don't support create().")); 115 new UnsupportedError("Pattern descriptors don't support create()."));
115 } 116 }
OLDNEW
« no previous file with comments | « pkg/polymer/lib/component_build.dart ('k') | pkg/unittest/lib/src/iterable_matchers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698