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

Unified Diff: tests/language/positional_parameters_type_test.dart

Issue 23479005: Rewrite two tests to multi-tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update expectations Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/language/named_parameters_type_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/language/positional_parameters_type_test.dart
diff --git a/tests/language/positional_parameters_type_test.dart b/tests/language/positional_parameters_type_test.dart
index 6c3c77d06d1102c43a2ff054dc3ca9e58508324b..7d14403dbd84d5830f1d56c5f033253c61f1a6b9 100644
--- a/tests/language/positional_parameters_type_test.dart
+++ b/tests/language/positional_parameters_type_test.dart
@@ -1,57 +1,23 @@
// Copyright (c) 2011, 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.
-// VMOptions=--enable_type_checks
+// VMOptions=--checked
//
// Dart test program for testing optional positional parameters in type tests.
-import "package:expect/expect.dart";
-
-class NamedParametersTypeTest {
- static int testMain() {
- int result = 0;
- Function anyFunction;
- void acceptFunNumOptBool(void funNumOptBool(num n, [bool b])) { };
- void funNum(num n) { };
- void funNumBool(num n, bool b) { };
- void funNumOptBool(num n, [bool b = true]) { };
- void funNumOptBoolX(num n, [bool x = true]) { };
- anyFunction = funNum; // No error.
- anyFunction = funNumBool; // No error.
- anyFunction = funNumOptBool; // No error.
- anyFunction = funNumOptBoolX; // No error.
- acceptFunNumOptBool(funNumOptBool); // No error.
- try {
- acceptFunNumOptBool(funNum); // No static type warning.
- } on TypeError catch (error) {
- result += 1;
- var msg = error.toString();
- Expect.isTrue(msg.contains("'(num, [bool]) => void'")); // dstType
- Expect.isTrue(msg.contains("'(num) => void'")); // srcType
- Expect.isTrue(msg.contains("'funNumOptBool'")); // dstName
- Expect.isTrue(error.stackTrace.toString().contains(
- "positional_parameters_type_test.dart:14:35"));
- }
- try {
- acceptFunNumOptBool(funNumBool); /// static type warning
- } on TypeError catch (error) {
- result += 10;
- var msg = error.toString();
- Expect.isTrue(msg.contains("'(num, [bool]) => void'")); // dstType
- Expect.isTrue(msg.contains("'(num, bool) => void'")); // srcType
- Expect.isTrue(msg.contains("'funNumOptBool'")); // dstName
- Expect.isTrue(error.stackTrace.toString().contains(
- "positional_parameters_type_test.dart:14:35"));
- }
- try {
- acceptFunNumOptBool(funNumOptBoolX); // No static type warning.
- } on TypeError catch (error) {
- result += 100;
- }
- return result;
- }
-}
-
main() {
- Expect.equals(11, NamedParametersTypeTest.testMain());
+ Function anyFunction;
+ void acceptFunNumOptBool(void funNumOptBool(num n, [bool b])) { };
+ void funNum(num n) { };
+ void funNumBool(num n, bool b) { };
+ void funNumOptBool(num n, [bool b = true]) { };
+ void funNumOptBoolX(num n, [bool x = true]) { };
+ anyFunction = funNum;
+ anyFunction = funNumBool;
+ anyFunction = funNumOptBool;
+ anyFunction = funNumOptBoolX;
+ acceptFunNumOptBool(funNumOptBool);
+ acceptFunNumOptBool(funNumOptBoolX);
+ acceptFunNumOptBool(funNum); /// 01: runtime error
+ acceptFunNumOptBool(funNumBool); /// 02: static type warning, runtime error
}
« no previous file with comments | « tests/language/named_parameters_type_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698