From 71a42aa2b617b7646a1de4550ffa956a885d7f8b Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum <nweiz@google.com> Date: Tue, 6 Dec 2016 14:42:12 -0800 Subject: [PATCH] Fix a Metadata bug. (#504) Closes #503 --- CHANGELOG.md | 4 ++++ lib/src/backend/metadata.dart | 8 ++++---- pubspec.yaml | 2 +- test/runner/configuration/tags_test.dart | 24 ++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a404ef59..3a67eb0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.12.17+1 + +* Fix a bug where tags couldn't be marked as skipped. + ## 0.12.17 * Deprecate `expectAsync` and `expectAsyncUntil`, since they currently can't be diff --git a/lib/src/backend/metadata.dart b/lib/src/backend/metadata.dart index 013d91f3..bdbf4705 100644 --- a/lib/src/backend/metadata.dart +++ b/lib/src/backend/metadata.dart @@ -262,8 +262,8 @@ class Metadata { new Metadata( testOn: testOn.intersection(other.testOn), timeout: timeout.merge(other.timeout), - skip: other._skip ?? _skip , - skipReason: other.skipReason == null ? skipReason : other.skipReason, + skip: other._skip ?? _skip, + skipReason: other.skipReason ?? skipReason, verboseTrace: other._verboseTrace ?? _verboseTrace, tags: tags.union(other.tags), onPlatform: mergeMaps(onPlatform, other.onPlatform, @@ -319,9 +319,9 @@ class Metadata { return { 'testOn': testOn == PlatformSelector.all ? null : testOn.toString(), 'timeout': _serializeTimeout(timeout), - 'skip': skip, + 'skip': _skip, 'skipReason': skipReason, - 'verboseTrace': verboseTrace, + 'verboseTrace': _verboseTrace, 'tags': tags.toList(), 'onPlatform': serializedOnPlatform, 'forTag': mapMap(forTag, diff --git a/pubspec.yaml b/pubspec.yaml index 0020fa00..8ce4edd8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: test -version: 0.12.17 +version: 0.12.17+1 author: Dart Team <misc@dartlang.org> description: A library for writing dart unit tests. homepage: https://github.com/dart-lang/test diff --git a/test/runner/configuration/tags_test.dart b/test/runner/configuration/tags_test.dart index 3968edd9..a4ff34c8 100644 --- a/test/runner/configuration/tags_test.dart +++ b/test/runner/configuration/tags_test.dart @@ -132,6 +132,30 @@ void main() { test.stdout.expect(consumeThrough(contains("+1: All tests passed!"))); test.shouldExit(0); }); + + // Regression test for #503. + test("skips tests whose tags are marked as skip", () { + d.file("dart_test.yaml", JSON.encode({ + "tags": {"foo": {"skip": "some reason"}} + })).create(); + + d.file("test.dart", """ + import 'dart:async'; + + import 'package:test/test.dart'; + + void main() { + test("test 1", () => throw 'bad', tags: ['foo']); + } + """).create(); + + var test = runTest(["test.dart"]); + test.stdout.expect(containsInOrder([ + "some reason", + "All tests skipped." + ])); + test.shouldExit(0); + }); }); group("include_tags and exclude_tags", () { -- GitLab