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

Side by Side Diff: lib/src/backend/platform_selector.dart

Issue 1053443002: Rename the package to "test". (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes 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 unified diff | Download patch
« no previous file with comments | « lib/src/backend/operating_system.dart ('k') | lib/src/backend/platform_selector/ast.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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 unittest.backend.platform_selector; 5 library test.backend.platform_selector;
6 6
7 import 'package:source_span/source_span.dart'; 7 import 'package:source_span/source_span.dart';
8 8
9 import 'operating_system.dart'; 9 import 'operating_system.dart';
10 import 'platform_selector/ast.dart'; 10 import 'platform_selector/ast.dart';
11 import 'platform_selector/evaluator.dart'; 11 import 'platform_selector/evaluator.dart';
12 import 'platform_selector/parser.dart'; 12 import 'platform_selector/parser.dart';
13 import 'platform_selector/visitor.dart'; 13 import 'platform_selector/visitor.dart';
14 import 'test_platform.dart'; 14 import 'test_platform.dart';
15 15
16 /// The set of all valid variable names. 16 /// The set of all valid variable names.
17 final _validVariables = 17 final _validVariables =
18 new Set<String>.from(["posix", "dart-vm", "browser", "js", "blink"]) 18 new Set<String>.from(["posix", "dart-vm", "browser", "js", "blink"])
19 ..addAll(TestPlatform.all.map((platform) => platform.identifier)) 19 ..addAll(TestPlatform.all.map((platform) => platform.identifier))
20 ..addAll(OperatingSystem.all.map((os) => os.name)); 20 ..addAll(OperatingSystem.all.map((os) => os.name));
21 21
22 /// An expression for selecting certain platforms, including operating systems 22 /// An expression for selecting certain platforms, including operating systems
23 /// and browsers. 23 /// and browsers.
24 /// 24 ///
25 /// The syntax is mostly Dart's expression syntax restricted to boolean 25 /// The syntax is mostly Dart's expression syntax restricted to boolean
26 /// operations. See [the README][] for full details. 26 /// operations. See [the README][] for full details.
27 /// 27 ///
28 /// [the README]: https://github.com/dart-lang/unittest/#platform-selector-synta x 28 /// [the README]: https://github.com/dart-lang/test/#platform-selector-syntax
29 abstract class PlatformSelector { 29 abstract class PlatformSelector {
30 /// A selector that declares that a test can be run on all platforms. 30 /// A selector that declares that a test can be run on all platforms.
31 /// 31 ///
32 /// This isn't representable in the platform selector syntax but it is the 32 /// This isn't representable in the platform selector syntax but it is the
33 /// default selector. 33 /// default selector.
34 static const all = const _AllPlatforms(); 34 static const all = const _AllPlatforms();
35 35
36 /// Parses [selector]. 36 /// Parses [selector].
37 /// 37 ///
38 /// This will throw a [SourceSpanFormatException] if the selector is 38 /// This will throw a [SourceSpanFormatException] if the selector is
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 /// and it isn't done when parsing to avoid coupling the syntax too tightly to 94 /// and it isn't done when parsing to avoid coupling the syntax too tightly to
95 /// the semantics. 95 /// the semantics.
96 class _VariableValidator extends RecursiveVisitor { 96 class _VariableValidator extends RecursiveVisitor {
97 const _VariableValidator(); 97 const _VariableValidator();
98 98
99 void visitVariable(VariableNode node) { 99 void visitVariable(VariableNode node) {
100 if (_validVariables.contains(node.name)) return; 100 if (_validVariables.contains(node.name)) return;
101 throw new SourceSpanFormatException("Undefined variable.", node.span); 101 throw new SourceSpanFormatException("Undefined variable.", node.span);
102 } 102 }
103 } 103 }
OLDNEW
« no previous file with comments | « lib/src/backend/operating_system.dart ('k') | lib/src/backend/platform_selector/ast.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698