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

Side by Side Diff: test/runner/parse_metadata_test.dart

Issue 1096693005: Support @Skip as a suite-level 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 | « lib/test.dart ('k') | test/runner/runner_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) 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 @TestOn("vm") 5 @TestOn("vm")
6 6
7 import 'dart:io'; 7 import 'dart:io';
8 8
9 import 'package:path/path.dart' as p; 9 import 'package:path/path.dart' as p;
10 import 'package:test/test.dart'; 10 import 'package:test/test.dart';
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 }); 221 });
222 222
223 test("a duplicate named argument", () { 223 test("a duplicate named argument", () {
224 new File(_path).writeAsStringSync( 224 new File(_path).writeAsStringSync(
225 "@Timeout(const Duration(seconds: 1, seconds: 1))\nlibrary foo;"); 225 "@Timeout(const Duration(seconds: 1, seconds: 1))\nlibrary foo;");
226 expect(() => parseMetadata(_path), throwsFormatException); 226 expect(() => parseMetadata(_path), throwsFormatException);
227 }); 227 });
228 }); 228 });
229 }); 229 });
230 }); 230 });
231
232 group("@Skip:", () {
233 test("parses a valid annotation", () {
234 new File(_path).writeAsStringSync("@Skip()\nlibrary foo;");
235 var metadata = parseMetadata(_path);
236 expect(metadata.skip, isTrue);
237 expect(metadata.skipReason, isNull);
238 });
239
240 test("parses a valid annotation with a reason", () {
241 new File(_path).writeAsStringSync("@Skip('reason')\nlibrary foo;");
242 var metadata = parseMetadata(_path);
243 expect(metadata.skip, isTrue);
244 expect(metadata.skipReason, equals('reason'));
245 });
246
247 test("ignores a constructor named Skip", () {
248 new File(_path).writeAsStringSync("@foo.Skip('foo')\nlibrary foo;");
249 var metadata = parseMetadata(_path);
250 expect(metadata.skip, isFalse);
251 });
252
253 group("throws an error for", () {
254 test("a named constructor", () {
255 new File(_path).writeAsStringSync("@Skip.name('foo')\nlibrary foo;");
256 expect(() => parseMetadata(_path), throwsFormatException);
257 });
258
259 test("no argument list", () {
260 new File(_path).writeAsStringSync("@Skip\nlibrary foo;");
261 expect(() => parseMetadata(_path), throwsFormatException);
262 });
263
264 test("a named argument", () {
265 new File(_path).writeAsStringSync(
266 "@Skip(reason: 'foo')\nlibrary foo;");
267 expect(() => parseMetadata(_path), throwsFormatException);
268 });
269
270 test("multiple arguments", () {
271 new File(_path).writeAsStringSync("@Skip('foo', 'bar')\nlibrary foo;");
272 expect(() => parseMetadata(_path), throwsFormatException);
273 });
274
275 test("a non-string argument", () {
276 new File(_path).writeAsStringSync("@Skip(123)\nlibrary foo;");
277 expect(() => parseMetadata(_path), throwsFormatException);
278 });
279
280 test("multiple @Skips", () {
281 new File(_path).writeAsStringSync(
282 "@Skip('foo')\n@Skip('bar')\nlibrary foo;");
283 expect(() => parseMetadata(_path), throwsFormatException);
284 });
285 });
286 });
231 } 287 }
OLDNEW
« no previous file with comments | « lib/test.dart ('k') | test/runner/runner_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698