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

Side by Side Diff: tests/language_2/dynamic_type_helper.dart

Issue 2999733002: Migrate test block 47 and downstream dependencies to Dart 2.0. (Closed)
Patch Set: Whitespace Created 3 years, 4 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
OLDNEW
(Empty)
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
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.
4
5 library dynamic_type_helper;
6
7 import 'package:expect/expect.dart';
8
9 /// Checks that a dynamic type error is thrown when [f] is executed
10 /// and [expectTypeError] is `true`.
11 void testDynamicTypeError(bool expectTypeError, f(), [String message]) {
12 if (expectTypeError) {
13 checkDynamicTypeError(f, message);
14 } else {
15 checkNoDynamicTypeError(f, message);
16 }
17 }
18
19 /// Checks that a dynamic type error is thrown when f is executed.
20 void checkDynamicTypeError(f(), [String message]) {
21 message = message != null ? ': $message' : '';
22 try {
23 f();
24 Expect.fail('Missing type error$message.');
25 } on TypeError catch (e) {}
26 }
27
28 /// Checks that no dynamic type error is thrown when [f] is executed.
29 void checkNoDynamicTypeError(f(), [String message]) {
30 message = message != null ? ': $message' : '';
31 try {
32 f();
33 } on TypeError catch (e) {
34 Expect.fail('Unexpected type error$message.');
35 }
36 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698