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

Unified Diff: lib/src/backend/message.dart

Issue 2091173002: Add metadata to messages emitted by live tests. (Closed) Base URL: git@github.com:dart-lang/test@master
Patch Set: Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/backend/live_test_controller.dart ('k') | lib/src/runner/engine.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/backend/message.dart
diff --git a/lib/src/backend/message.dart b/lib/src/backend/message.dart
new file mode 100644
index 0000000000000000000000000000000000000000..0632fe23ca960ee2ef1f4bcb8ed569cef9f45ec2
--- /dev/null
+++ b/lib/src/backend/message.dart
@@ -0,0 +1,42 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// A message emitted by a test.
+///
+/// A message encompasses any textual information that should be presented to
+/// the user. Reporters are encouraged to visually distinguish different message
+/// types.
+class Message {
+ final MessageType type;
+
+ final String text;
+
+ Message(this.type, this.text);
+
+ Message.print(this.text) : type = MessageType.print;
+ Message.skip(this.text) : type = MessageType.skip;
+}
+
+class MessageType {
+ /// A message explicitly printed by the user's test.
+ static const print = const MessageType._("print");
+
+ /// A message indicating that a test, or some portion of one, was skipped.
+ static const skip = const MessageType._("skip");
+
+ /// The name of the message type.
+ final String name;
+
+ factory MessageType.parse(String name) {
+ switch (name) {
+ case "print": return MessageType.print;
+ case "skip": return MessageType.skip;
+ default: throw new ArgumentError('Invalid message type "$name".');
+ }
+ }
+
+ const MessageType._(this.name);
+
+ String toString() => name;
+}
« no previous file with comments | « lib/src/backend/live_test_controller.dart ('k') | lib/src/runner/engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698