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

Side by Side Diff: test/runner/configuration/configuration_test.dart

Issue 1715583003: Use boolean selector syntax for tags. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Code review changes Created 4 years, 10 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 | « test/backend/metadata_test.dart ('k') | test/runner/configuration/tags_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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 @TestOn("vm") 5 @TestOn("vm")
6 6
7 import 'package:boolean_selector/boolean_selector.dart';
7 import 'package:path/path.dart' as p; 8 import 'package:path/path.dart' as p;
8 import 'package:test/test.dart'; 9 import 'package:test/test.dart';
9 10
10 import 'package:test/src/backend/test_platform.dart'; 11 import 'package:test/src/backend/test_platform.dart';
11 import 'package:test/src/runner/configuration.dart'; 12 import 'package:test/src/runner/configuration.dart';
12 import 'package:test/src/runner/configuration/values.dart'; 13 import 'package:test/src/runner/configuration/values.dart';
13 import 'package:test/src/util/io.dart'; 14 import 'package:test/src/util/io.dart';
14 15
15 void main() { 16 void main() {
16 group("merge", () { 17 group("merge", () {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 expect(merged.pubServeUrl.port, equals(5678)); 132 expect(merged.pubServeUrl.port, equals(5678));
132 expect(merged.pattern, equals("gonk")); 133 expect(merged.pattern, equals("gonk"));
133 expect(merged.platforms, equals([TestPlatform.dartium])); 134 expect(merged.platforms, equals([TestPlatform.dartium]));
134 expect(merged.paths, equals(["blech"])); 135 expect(merged.paths, equals(["blech"]));
135 }); 136 });
136 }); 137 });
137 138
138 group("for tags", () { 139 group("for tags", () {
139 test("if neither is defined, preserves the default", () { 140 test("if neither is defined, preserves the default", () {
140 var merged = new Configuration().merge(new Configuration()); 141 var merged = new Configuration().merge(new Configuration());
141 expect(merged.includeTags, isEmpty); 142 expect(merged.includeTags, equals(BooleanSelector.all));
142 expect(merged.excludeTags, isEmpty); 143 expect(merged.excludeTags, equals(BooleanSelector.none));
143 }); 144 });
144 145
145 test("if only the old configuration's is defined, uses it", () { 146 test("if only the old configuration's is defined, uses it", () {
146 var merged = new Configuration( 147 var merged = new Configuration(
147 includeTags: ["foo", "bar"], 148 includeTags: new BooleanSelector.parse("foo || bar"),
148 excludeTags: ["baz", "bang"]) 149 excludeTags: new BooleanSelector.parse("baz || bang"))
149 .merge(new Configuration()); 150 .merge(new Configuration());
150 151
151 expect(merged.includeTags, unorderedEquals(["foo", "bar"])); 152 expect(merged.includeTags,
152 expect(merged.excludeTags, unorderedEquals(["baz", "bang"])); 153 equals(new BooleanSelector.parse("foo || bar")));
154 expect(merged.excludeTags,
155 equals(new BooleanSelector.parse("baz || bang")));
153 }); 156 });
154 157
155 test("if only the new configuration's is defined, uses it", () { 158 test("if only the new configuration's is defined, uses it", () {
156 var merged = new Configuration().merge(new Configuration( 159 var merged = new Configuration().merge(new Configuration(
157 includeTags: ["foo", "bar"], 160 includeTags: new BooleanSelector.parse("foo || bar"),
158 excludeTags: ["baz", "bang"])); 161 excludeTags: new BooleanSelector.parse("baz || bang")));
159 162
160 expect(merged.includeTags, unorderedEquals(["foo", "bar"])); 163 expect(merged.includeTags,
161 expect(merged.excludeTags, unorderedEquals(["baz", "bang"])); 164 equals(new BooleanSelector.parse("foo || bar")));
165 expect(merged.excludeTags,
166 equals(new BooleanSelector.parse("baz || bang")));
162 }); 167 });
163 168
164 test("if both are defined, unions them", () { 169 test("if both are defined, unions or intersects them", () {
165 var older = new Configuration( 170 var older = new Configuration(
166 includeTags: ["foo", "bar"], 171 includeTags: new BooleanSelector.parse("foo || bar"),
167 excludeTags: ["baz", "bang"]); 172 excludeTags: new BooleanSelector.parse("baz || bang"));
168 var newer = new Configuration( 173 var newer = new Configuration(
169 includeTags: ["bar", "blip"], 174 includeTags: new BooleanSelector.parse("blip"),
170 excludeTags: ["bang", "qux"]); 175 excludeTags: new BooleanSelector.parse("qux"));
171 var merged = older.merge(newer); 176 var merged = older.merge(newer);
172 177
173 expect(merged.includeTags, unorderedEquals(["foo", "bar", "blip"])); 178 expect(merged.includeTags,
174 expect(merged.excludeTags, unorderedEquals(["baz", "bang", "qux"])); 179 equals(new BooleanSelector.parse("(foo || bar) && blip")));
180 expect(merged.excludeTags,
181 equals(new BooleanSelector.parse("(baz || bang) || qux")));
175 }); 182 });
176 }); 183 });
177 184
178 group("for timeout", () { 185 group("for timeout", () {
179 test("if neither is defined, preserves the default", () { 186 test("if neither is defined, preserves the default", () {
180 var merged = new Configuration().merge(new Configuration()); 187 var merged = new Configuration().merge(new Configuration());
181 expect(merged.timeout, equals(new Timeout.factor(1))); 188 expect(merged.timeout, equals(new Timeout.factor(1)));
182 }); 189 });
183 190
184 test("if only the old configuration's is defined, uses it", () { 191 test("if only the old configuration's is defined, uses it", () {
(...skipping 19 matching lines...) Expand all
204 var older = new Configuration( 211 var older = new Configuration(
205 timeout: new Timeout(new Duration(seconds: 1))); 212 timeout: new Timeout(new Duration(seconds: 1)));
206 var newer = new Configuration( 213 var newer = new Configuration(
207 timeout: new Timeout(new Duration(seconds: 2))); 214 timeout: new Timeout(new Duration(seconds: 2)));
208 var merged = older.merge(newer); 215 var merged = older.merge(newer);
209 expect(merged.timeout, equals(new Timeout(new Duration(seconds: 2)))); 216 expect(merged.timeout, equals(new Timeout(new Duration(seconds: 2))));
210 }); 217 });
211 }); 218 });
212 }); 219 });
213 } 220 }
OLDNEW
« no previous file with comments | « test/backend/metadata_test.dart ('k') | test/runner/configuration/tags_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698