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

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

Issue 1092153003: Support an @OnPlatform annotation. (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 | « README.md ('k') | lib/src/frontend/on_platform.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 test.backend.suite; 5 library test.backend.suite;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'metadata.dart'; 9 import 'metadata.dart';
10 import 'operating_system.dart'; 10 import 'operating_system.dart';
(...skipping 26 matching lines...) Expand all
37 /// 37 ///
38 /// This filters out tests that are invalid for [platform] and [os] and 38 /// This filters out tests that are invalid for [platform] and [os] and
39 /// resolves platform-specific metadata. If the suite itself is invalid for 39 /// resolves platform-specific metadata. If the suite itself is invalid for
40 /// [platform] and [os], returns `null`. 40 /// [platform] and [os], returns `null`.
41 Suite forPlatform(TestPlatform platform, {OperatingSystem os}) { 41 Suite forPlatform(TestPlatform platform, {OperatingSystem os}) {
42 if (!metadata.testOn.evaluate(platform, os: os)) return null; 42 if (!metadata.testOn.evaluate(platform, os: os)) return null;
43 return change(tests: tests.where((test) { 43 return change(tests: tests.where((test) {
44 return test.metadata.testOn.evaluate(platform, os: os); 44 return test.metadata.testOn.evaluate(platform, os: os);
45 }).map((test) { 45 }).map((test) {
46 return test.change(metadata: test.metadata.forPlatform(platform, os: os)); 46 return test.change(metadata: test.metadata.forPlatform(platform, os: os));
47 })); 47 }), metadata: metadata.forPlatform(platform, os: os));
48 } 48 }
49 49
50 /// Returns a new suite with the given fields updated. 50 /// Returns a new suite with the given fields updated.
51 Suite change({String path, String platform, Metadata metadata, 51 Suite change({String path, String platform, Metadata metadata,
52 Iterable<Test> tests}) { 52 Iterable<Test> tests}) {
53 if (path == null) path = this.path; 53 if (path == null) path = this.path;
54 if (platform == null) platform = this.platform; 54 if (platform == null) platform = this.platform;
55 if (metadata == null) metadata = this.metadata; 55 if (metadata == null) metadata = this.metadata;
56 if (tests == null) tests = this.tests; 56 if (tests == null) tests = this.tests;
57 return new Suite(tests, path: path, platform: platform, metadata: metadata); 57 return new Suite(tests, path: path, platform: platform, metadata: metadata);
58 } 58 }
59 } 59 }
OLDNEW
« no previous file with comments | « README.md ('k') | lib/src/frontend/on_platform.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698