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

Side by Side Diff: test/backend/metadata_test.dart

Issue 1709633003: Add the ability to add tags in the test config. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: 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 | « lib/src/runner/configuration/load.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) 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 import 'package:test/src/backend/metadata.dart'; 5 import 'package:test/src/backend/metadata.dart';
6 import 'package:test/src/backend/test_platform.dart'; 6 import 'package:test/src/backend/test_platform.dart';
7 import 'package:test/src/frontend/timeout.dart'; 7 import 'package:test/src/frontend/timeout.dart';
8 import 'package:test/src/frontend/skip.dart'; 8 import 'package:test/src/frontend/skip.dart';
9 import 'package:test/test.dart'; 9 import 'package:test/test.dart';
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 }); 61 });
62 62
63 test("returns the normal metadata if forTag doesn't match tags", () { 63 test("returns the normal metadata if forTag doesn't match tags", () {
64 var metadata = new Metadata( 64 var metadata = new Metadata(
65 verboseTrace: true, 65 verboseTrace: true,
66 tags: ['bar', 'baz'], 66 tags: ['bar', 'baz'],
67 forTag: {'foo': new Metadata(skip: true)}); 67 forTag: {'foo': new Metadata(skip: true)});
68 68
69 expect(metadata.verboseTrace, isTrue); 69 expect(metadata.verboseTrace, isTrue);
70 expect(metadata.skip, isFalse); 70 expect(metadata.skip, isFalse);
71 expect(metadata.tags, ['bar', 'baz']); 71 expect(metadata.tags, unorderedEquals(['bar', 'baz']));
72 expect(metadata.forTag, contains('foo')); 72 expect(metadata.forTag, contains('foo'));
73 expect(metadata.forTag['foo'].skip, isTrue); 73 expect(metadata.forTag['foo'].skip, isTrue);
74 }); 74 });
75 75
76 test("resolves forTags that match tags", () { 76 test("resolves forTags that match tags", () {
77 var metadata = new Metadata( 77 var metadata = new Metadata(
78 verboseTrace: true, 78 verboseTrace: true,
79 tags: ['foo', 'bar', 'baz'], 79 tags: ['foo', 'bar', 'baz'],
80 forTag: { 80 forTag: {
81 'foo': new Metadata(skip: true), 81 'foo': new Metadata(skip: true),
82 'baz': new Metadata(timeout: Timeout.none), 82 'baz': new Metadata(timeout: Timeout.none),
83 'qux': new Metadata(skipReason: "blah") 83 'qux': new Metadata(skipReason: "blah")
84 }); 84 });
85 85
86 expect(metadata.verboseTrace, isTrue); 86 expect(metadata.verboseTrace, isTrue);
87 expect(metadata.skip, isTrue); 87 expect(metadata.skip, isTrue);
88 expect(metadata.skipReason, isNull); 88 expect(metadata.skipReason, isNull);
89 expect(metadata.timeout, equals(Timeout.none)); 89 expect(metadata.timeout, equals(Timeout.none));
90 expect(metadata.tags, equals(['foo', 'bar', 'baz'])); 90 expect(metadata.tags, unorderedEquals(['foo', 'bar', 'baz']));
91 expect(metadata.forTag.keys, equals(['qux'])); 91 expect(metadata.forTag.keys, equals(['qux']));
92 }); 92 });
93 93
94 test("resolves forTags that adds a behavioral tag", () {
95 var metadata = new Metadata(
96 tags: ['foo'],
97 forTag: {
98 'baz': new Metadata(skip: true),
99 'bar': new Metadata(verboseTrace: true, tags: ['baz']),
100 'foo': new Metadata(tags: ['bar'])
101 });
102
103 expect(metadata.verboseTrace, isTrue);
104 expect(metadata.skip, isTrue);
105 expect(metadata.tags, unorderedEquals(['foo', 'bar', 'baz']));
106 expect(metadata.forTag, isEmpty);
107 });
108
109 test("resolves forTags that adds circular tags", () {
110 var metadata = new Metadata(
111 tags: ['foo'],
112 forTag: {
113 'foo': new Metadata(tags: ['bar']),
114 'bar': new Metadata(tags: ['baz']),
115 'baz': new Metadata(tags: ['foo'])
116 });
117
118 expect(metadata.tags, unorderedEquals(['foo', 'bar', 'baz']));
119 expect(metadata.forTag, isEmpty);
120 });
121
94 test("base metadata takes precedence over forTags", () { 122 test("base metadata takes precedence over forTags", () {
95 var metadata = new Metadata( 123 var metadata = new Metadata(
96 verboseTrace: true, 124 verboseTrace: true,
97 tags: ['foo'], 125 tags: ['foo'],
98 forTag: {'foo': new Metadata(verboseTrace: false)}); 126 forTag: {'foo': new Metadata(verboseTrace: false)});
99 127
100 expect(metadata.verboseTrace, isTrue); 128 expect(metadata.verboseTrace, isTrue);
101 }); 129 });
102 }); 130 });
103 131
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 }, throwsArgumentError); 176 }, throwsArgumentError);
149 }); 177 });
150 178
151 test("refuses multiple Skips", () { 179 test("refuses multiple Skips", () {
152 expect(() { 180 expect(() {
153 new Metadata.parse(onPlatform: {"chrome": [new Skip(), new Skip()]}); 181 new Metadata.parse(onPlatform: {"chrome": [new Skip(), new Skip()]});
154 }, throwsArgumentError); 182 }, throwsArgumentError);
155 }); 183 });
156 }); 184 });
157 } 185 }
OLDNEW
« no previous file with comments | « lib/src/runner/configuration/load.dart ('k') | test/runner/configuration/tags_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698