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

Side by Side Diff: lib/src/utils.dart

Issue 1491383003: Disallow non-hyphenated-identifier tag names. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 5 years 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
« no previous file with comments | « lib/src/runner/parse_metadata.dart ('k') | test/runner/tag_test.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 test.utils; 5 library test.utils;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:math' as math; 9 import 'dart:math' as math;
10 10
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 /// This is useful for running test files directly and skipping tests as 53 /// This is useful for running test files directly and skipping tests as
54 /// appropriate. The only OS-specific information we have is the current path, 54 /// appropriate. The only OS-specific information we have is the current path,
55 /// which we try to use to figure out the OS. 55 /// which we try to use to figure out the OS.
56 final OperatingSystem currentOSGuess = (() { 56 final OperatingSystem currentOSGuess = (() {
57 if (p.style == p.Style.url) return OperatingSystem.none; 57 if (p.style == p.Style.url) return OperatingSystem.none;
58 if (p.style == p.Style.windows) return OperatingSystem.windows; 58 if (p.style == p.Style.windows) return OperatingSystem.windows;
59 if (_macOSDirectories.any(p.current.startsWith)) return OperatingSystem.macOS; 59 if (_macOSDirectories.any(p.current.startsWith)) return OperatingSystem.macOS;
60 return OperatingSystem.linux; 60 return OperatingSystem.linux;
61 })(); 61 })();
62 62
63 /// A regular expression matching a hyphenated identifier.
64 ///
65 /// This is like a standard Dart identifier, except that it can also contain
66 /// hyphens.
67 final hyphenatedIdentifier = new RegExp(r"[a-zA-Z_-][a-zA-Z0-9_-]*");
68
69 /// Like [hyphenatedIdentifier], but anchored so that it must match the entire
70 /// string.
71 final anchoredHyphenatedIdentifier =
72 new RegExp("^${hyphenatedIdentifier.pattern}\$");
73
63 /// A pair of values. 74 /// A pair of values.
64 class Pair<E, F> { 75 class Pair<E, F> {
65 E first; 76 E first;
66 F last; 77 F last;
67 78
68 Pair(this.first, this.last); 79 Pair(this.first, this.last);
69 80
70 String toString() => '($first, $last)'; 81 String toString() => '($first, $last)';
71 82
72 bool operator==(other) { 83 bool operator==(other) {
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 urlSafe: urlSafe, addLineSeparator: addLineSeparator); 416 urlSafe: urlSafe, addLineSeparator: addLineSeparator);
406 } 417 }
407 418
408 /// Returns middleware that nests all requests beneath the URL prefix [beneath]. 419 /// Returns middleware that nests all requests beneath the URL prefix [beneath].
409 shelf.Middleware nestingMiddleware(String beneath) { 420 shelf.Middleware nestingMiddleware(String beneath) {
410 return (handler) { 421 return (handler) {
411 var pathHandler = new PathHandler()..add(beneath, handler); 422 var pathHandler = new PathHandler()..add(beneath, handler);
412 return pathHandler.handler; 423 return pathHandler.handler;
413 }; 424 };
414 } 425 }
OLDNEW
« no previous file with comments | « lib/src/runner/parse_metadata.dart ('k') | test/runner/tag_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698