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

Side by Side Diff: pkg/testing/lib/src/multitest.dart

Issue 2641833002: Dynamic type error implies checked mode. (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | no next file » | 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.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 library testing.multitest; 5 library testing.multitest;
6 6
7 import 'dart:async' show 7 import 'dart:async' show
8 Stream, 8 Stream,
9 StreamTransformer; 9 StreamTransformer;
10 10
11 import 'dart:io' show 11 import 'dart:io' show
12 Directory, 12 Directory,
13 File; 13 File;
14 14
15 import 'log.dart' show 15 import 'log.dart' show
16 splitLines; 16 splitLines;
17 17
18 import 'test_description.dart' show 18 import 'test_description.dart' show
19 TestDescription; 19 TestDescription;
20 20
21 bool isError(Set<String> expectations) { 21 bool isError(Set<String> expectations) {
22 if (expectations.contains("compile-time error")) return true; 22 if (expectations.contains("compile-time error")) return true;
23 if (expectations.contains("runtime error")) return true; 23 if (expectations.contains("runtime error")) return true;
24 if (expectations.contains("dynamic type error")) return true;
25 return false; 24 return false;
26 } 25 }
27 26
28 bool isCheckedModeError(Set<String> expectations) { 27 bool isCheckedModeError(Set<String> expectations) {
29 if (expectations.contains("checked mode compile-time error")) return true; 28 if (expectations.contains("checked mode compile-time error")) return true;
29 if (expectations.contains("dynamic type error")) return true;
30 return isError(expectations); 30 return isError(expectations);
31 } 31 }
32 32
33 class MultitestTransformer 33 class MultitestTransformer
34 implements StreamTransformer<TestDescription, TestDescription> { 34 implements StreamTransformer<TestDescription, TestDescription> {
35 static const String multitestMarker = "///"; 35 static const String multitestMarker = "///";
36 36
37 static const List<String> validOutcomesList = const <String>[ 37 static const List<String> validOutcomesList = const <String>[
38 "ok", 38 "ok",
39 "compile-time error", 39 "compile-time error",
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 subtest.multitestExpectations = outcomes[name]; 128 subtest.multitestExpectations = outcomes[name];
129 await subtest.file.writeAsString(lines.join("")); 129 await subtest.file.writeAsString(lines.join(""));
130 yield subtest; 130 yield subtest;
131 } 131 }
132 } 132 }
133 if (errors.isNotEmpty) { 133 if (errors.isNotEmpty) {
134 throw "Error: ${errors.join("\n")}"; 134 throw "Error: ${errors.join("\n")}";
135 } 135 }
136 } 136 }
137 } 137 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698