mirror of
https://github.com/dart-lang/sdk
synced 2024-10-06 17:15:02 +00:00
Rewrite two tests to multi-tests
R=ahe@google.com BUG= Review URL: https://codereview.chromium.org//23479005 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26904 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
62ef9aea7c
commit
778e057e05
|
@ -67,6 +67,11 @@ compile_time_constant_checked3_test/04: Fail, OK
|
|||
compile_time_constant_checked3_test/05: Fail, OK
|
||||
compile_time_constant_checked3_test/06: Fail, OK
|
||||
generic_test: Fail, OK
|
||||
named_parameters_type_test/01: Fail, OK
|
||||
named_parameters_type_test/02: Fail, OK
|
||||
named_parameters_type_test/03: Fail, OK
|
||||
positional_parameters_type_test/01: Fail, OK
|
||||
positional_parameters_type_test/02: Fail, OK
|
||||
|
||||
[ $compiler == dart2js && $minified ]
|
||||
f_bounded_quantification4_test: Fail # Issue 12605.
|
||||
|
@ -118,8 +123,6 @@ dynamic_prefix_core_test: Fail # Issue 12398
|
|||
metadata_test: Fail # Issue 5841
|
||||
infinity_test: Fail # Issue 4984
|
||||
positive_bit_operations_test: Fail # Issue 12795
|
||||
named_parameters_type_test: Fail
|
||||
positional_parameters_type_test: Fail
|
||||
|
||||
# Compilation errors.
|
||||
const_var_test: Fail # Issue 12793
|
||||
|
@ -388,6 +391,7 @@ function_type_alias5_test/01: Fail # Issue 12755
|
|||
function_type_alias5_test/02: Fail # Issue 12755
|
||||
function_type_alias7_test/00: Fail # Issue 12802
|
||||
parameter_initializer6_negative_test: Fail # Issue 3502
|
||||
|
||||
# DartVM problem.
|
||||
constructor5_test: Fail
|
||||
constructor6_test: Fail
|
||||
|
@ -422,7 +426,6 @@ compile_time_constant_checked3_test/04: Fail, OK
|
|||
compile_time_constant_checked3_test/05: Fail, OK
|
||||
compile_time_constant_checked3_test/06: Fail, OK
|
||||
|
||||
positional_parameters_type_test: Fail # Triage this.
|
||||
final_is_not_const_test/01: Fail # Issue 12692
|
||||
|
||||
[ $compiler == dart2dart && $minified ]
|
||||
|
|
|
@ -1,54 +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 named 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, {b: bool}) => void")); // dstType
|
||||
Expect.isTrue(msg.contains("(num) => void")); // srcType
|
||||
}
|
||||
try {
|
||||
acceptFunNumOptBool(funNumBool); /// static type warning
|
||||
} on TypeError catch (error) {
|
||||
result += 10;
|
||||
var msg = error.toString();
|
||||
Expect.isTrue(msg.contains("(num, {b: bool}) => void")); // dstType
|
||||
Expect.isTrue(msg.contains("(num, bool) => void")); // srcType
|
||||
}
|
||||
try {
|
||||
acceptFunNumOptBool(funNumOptBoolX); /// static type warning
|
||||
} on TypeError catch (error) {
|
||||
result += 100;
|
||||
var msg = error.toString();
|
||||
Expect.isTrue(msg.contains("(num, {b: bool}) => void")); // dstType
|
||||
Expect.isTrue(msg.contains("(num, {x: bool}) => void")); // srcType
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
main() {
|
||||
Expect.equals(111, 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(funNum); /// 01: runtime error
|
||||
acceptFunNumOptBool(funNumBool); /// 02: static type warning, runtime error
|
||||
acceptFunNumOptBool(funNumOptBoolX); /// 03: static type warning, runtime error
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue