Migrate test block 153 to Dart 2.0.

Change-Id: Ide65fb47af440e32648d01f46ad6f858b9faeadf
Reviewed-on: https://dart-review.googlesource.com/3742
Reviewed-by: Bob Nystrom <rnystrom@google.com>
This commit is contained in:
pq
2017-09-19 16:20:45 +00:00
committed by Phil Quitslund
parent bd33fb43bd
commit ced11f1b0c
42 changed files with 216 additions and 356 deletions
@@ -1,27 +0,0 @@
// Copyright (c) 2012, 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.
// Replace with shared test once interface issues clarified.
// Test various String intrinsics
// VMOptions=--optimization-counter-threshold=10 --no-background-compilation
import "package:expect/expect.dart";
main() {
var oneByte = "Hello world";
var empty = "";
for (int i = 0; i < 20; i++) {
Expect.equals(11, testLength(oneByte));
Expect.equals(0, testLength(empty));
Expect.isFalse(testIsEmpty(oneByte));
Expect.isTrue(testIsEmpty(empty));
}
}
testLength(s) {
return s.length;
}
testIsEmpty(s) {
return s.isEmpty;
}
@@ -1,27 +0,0 @@
// Copyright (c) 2013, 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.
// Regression test for dart2js's type inferrer, that used to not
// correctly infer optional named parameters.
import "package:expect/expect.dart";
import "compiler_annotations.dart";
@DontInline()
foo({path}) {
() => 42;
return path.toString();
}
@DontInline()
bar({path}) {
() => 42;
return path;
}
main() {
var a = [foo(path: '42'), foo(), 42, bar(path: '54')];
Expect.isTrue(a[1] is String);
Expect.throws(() => bar().concat('54'), (e) => e is NoSuchMethodError);
}
@@ -1,15 +0,0 @@
// 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.
class StringUnicode4NegativeTest {
static testMain() {
// Unicode escapes must refer to valid Unicode points.
String str = "Foo\u{FFFFFF}";
}
}
main() {
StringUnicode4NegativeTest.testMain();
}
@@ -1,147 +0,0 @@
// Copyright (c) 2014, 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.
import "package:expect/expect.dart";
@AssumeDynamic()
@NoInline()
confuse(x) => x;
class A {
bar([var optional = 1]) => 498 + optional;
bar2({namedOptional: 2}) => 40 + namedOptional;
bar3(x, [var optional = 3]) => x + 498 + optional;
bar4(x, {namedOptional: 4}) => 422 + x + namedOptional;
// Gee is the same as bar, but we make sure that gee is used. Potentially
// this yields different code if the redirecting stub exists.
gee([var optional = 1]) => 498 + optional;
gee2({namedOptional: 2}) => 40 + namedOptional;
gee3(x, [var optional = 3]) => x + 498 + optional;
gee4(x, {namedOptional: 4}) => 422 + x + namedOptional;
// Use identifiers that could be intercepted.
add([var optional = 33]) => 1234 + optional;
trim({namedOptional: 22}) => 1313 + namedOptional;
sublist(x, [optional = 44]) => 4321 + optional + x;
splitMapJoin(x, {onMatch: 55, onNonMatch: 66}) =>
111 + x + onMatch + onNonMatch;
// Other interceptable identifiers, but all of them are used.
shuffle([var optional = 121]) => 12342 + optional;
toList({growable: 2233}) => 13131 + growable;
lastIndexOf(x, [optional = 424]) => 14321 + optional + x;
lastWhere(x, {orElse: 555}) => x + 1213 + 555;
}
class B extends A {
// The closure `super.bar` is invoked without the optional argument.
// Dart2js must not generate a `bar$0 => bar$1(null)` closure, since that
// would redirect to B's `bar$1`. Instead it must enforce that `bar$0` in
// `A` redirects to A's bar$1.
foo() => confuse(super.bar)();
foo2() => confuse(super.bar)(2);
foo3() => confuse(super.bar2)();
foo4() => confuse(super.bar2)(namedOptional: 77);
foo5() => confuse(super.bar3)(-3);
foo6() => confuse(super.bar3)(-11, -19);
foo7() => confuse(super.bar4)(0);
foo8() => confuse(super.bar4)(3, namedOptional: 77);
fooGee() => confuse(super.gee)();
fooGee2() => confuse(super.gee)(2);
fooGee3() => confuse(super.gee2)();
fooGee4() => confuse(super.gee2)(namedOptional: 77);
fooGee5() => confuse(super.gee3)(-3);
fooGee6() => confuse(super.gee3)(-11, -19);
fooGee7() => confuse(super.gee4)(0);
fooGee8() => confuse(super.gee4)(3, namedOptional: 77);
fooIntercept() => confuse(super.add)();
fooIntercept2() => confuse(super.add)(2);
fooIntercept3() => confuse(super.trim)();
fooIntercept4() => confuse(super.trim)(namedOptional: 77);
fooIntercept5() => confuse(super.sublist)(-3);
fooIntercept6() => confuse(super.sublist)(-11, -19);
fooIntercept7() => confuse(super.splitMapJoin)(0);
fooIntercept8() => confuse(super.splitMapJoin)(3, onMatch: 77, onNonMatch: 8);
fooIntercept21() => confuse(super.shuffle)();
fooIntercept22() => confuse(super.shuffle)(2);
fooIntercept23() => confuse(super.toList)();
fooIntercept24() => confuse(super.toList)(growable: 77);
fooIntercept25() => confuse(super.lastIndexOf)(-3);
fooIntercept26() => confuse(super.lastIndexOf)(-11, -19);
fooIntercept27() => confuse(super.lastWhere)(0);
fooIntercept28() => confuse(super.lastWhere)(3, orElse: 77);
bar([var optional]) => -1; // //# 01: static type warning
bar2({ namedOptional }) => -1; // //# 01: continued
bar3(x, [var optional]) => -1; // //# 01: continued
bar4(x, { namedOptional }) => -1; //# 01: continued
gee([var optional]) => -1; // //# 01: continued
gee2({ namedOptional }) => -1; // //# 01: continued
gee3(x, [var optional]) => -1; // //# 01: continued
gee4(x, { namedOptional }) => -1; //# 01: continued
add([var optional = 33]) => -1;
trim({namedOptional: 22}) => -1;
sublist(x, [optional = 44]) => -1;
splitMapJoin(x, {onMatch: 55, onNonMatch: 66}) => -1;
shuffle([var optional = 121]) => -1;
toList({growable: 2233}) => -1;
lastIndexOf(x, [optional = 424]) => -1;
lastWhere(x, {orElse: 555}) => -1;
}
main() {
var list = [new A(), new B(), [], "foo"];
var a = list[confuse(0)];
var b = list[confuse(1)];
var ignored = list[confuse(2)];
var ignored2 = list[confuse(3)];
var t = b.gee() + b.gee2() + b.gee3(9) + b.gee4(19);
Expect.equals(-4, t); //# 01: continued
t = b.shuffle() + b.toList() + b.lastIndexOf(1) + b.lastWhere(2);
Expect.equals(-4, t);
Expect.equals(499, b.foo()); // //# 01: continued
Expect.equals(500, b.foo2()); //# 01: continued
Expect.equals(42, b.foo3()); // //# 01: continued
Expect.equals(117, b.foo4()); //# 01: continued
Expect.equals(498, b.foo5()); //# 01: continued
Expect.equals(468, b.foo6()); //# 01: continued
Expect.equals(426, b.foo7()); //# 01: continued
Expect.equals(502, b.foo8()); //# 01: continued
Expect.equals(499, b.fooGee()); // //# 01: continued
Expect.equals(500, b.fooGee2()); //# 01: continued
Expect.equals(42, b.fooGee3()); // //# 01: continued
Expect.equals(117, b.fooGee4()); //# 01: continued
Expect.equals(498, b.fooGee5()); //# 01: continued
Expect.equals(468, b.fooGee6()); //# 01: continued
Expect.equals(426, b.fooGee7()); //# 01: continued
Expect.equals(502, b.fooGee8()); //# 01: continued
Expect.equals(1267, b.fooIntercept());
Expect.equals(1236, b.fooIntercept2());
Expect.equals(1335, b.fooIntercept3());
Expect.equals(1390, b.fooIntercept4());
Expect.equals(4362, b.fooIntercept5());
Expect.equals(4291, b.fooIntercept6());
Expect.equals(232, b.fooIntercept7());
Expect.equals(199, b.fooIntercept8());
Expect.equals(12463, b.fooIntercept21());
Expect.equals(12344, b.fooIntercept22());
Expect.equals(15364, b.fooIntercept23());
Expect.equals(13208, b.fooIntercept24());
Expect.equals(14742, b.fooIntercept25());
Expect.equals(14291, b.fooIntercept26());
Expect.equals(1768, b.fooIntercept27());
Expect.equals(1771, b.fooIntercept28());
}
+41 -2
View File
@@ -162,7 +162,13 @@ static_getter_no_setter2_test/01: MissingCompileTimeError
static_getter_no_setter3_test/01: MissingCompileTimeError
static_setter_get_test/01: MissingCompileTimeError
static_initializer_type_error_test: MissingCompileTimeError
string_interpolate_test: StaticWarning
string_interpolate_test: MissingCompileTimeError
string_test/01: MissingCompileTimeError
string_unicode1_negative_test: CompileTimeError
string_unicode2_negative_test: CompileTimeError
string_unicode3_negative_test: CompileTimeError
string_unicode4_negative_test: CompileTimeError
super_bound_closure_test/01: MissingCompileTimeError
type_variable_static_context_test: MissingCompileTimeError
[ $compiler == dart2analyzer && ! $strong && $checked ]
@@ -292,7 +298,13 @@ static_getter_no_setter2_test/01: MissingCompileTimeError
static_getter_no_setter3_test/01: MissingCompileTimeError
static_setter_get_test/01: MissingCompileTimeError
static_initializer_type_error_test: MissingCompileTimeError
string_interpolate_test: StaticWarning
string_interpolate_test: MissingCompileTimeError
string_test/01: MissingCompileTimeError
string_unicode1_negative_test: CompileTimeError
string_unicode2_negative_test: CompileTimeError
string_unicode3_negative_test: CompileTimeError
string_unicode4_negative_test: CompileTimeError
super_bound_closure_test/01: MissingCompileTimeError
type_variable_static_context_test: MissingCompileTimeError
[ $compiler == dart2analyzer ]
@@ -372,6 +384,13 @@ generics_test: CompileTimeError
import_core_prefix_test: CompileTimeError # "dynamic" should be defined in core.
multiple_interface_inheritance_test: CompileTimeError # Issue 30552
regress_30339_test: CompileTimeError
string_supertype_checked_test: CompileTimeError
string_unicode1_negative_test: CompileTimeError
string_unicode2_negative_test: CompileTimeError
string_unicode3_negative_test: CompileTimeError
string_unicode4_negative_test: CompileTimeError
string_split_test: CompileTimeError
super_bound_closure_test/none: CompileTimeError
vm/lazy_deopt_with_exception*: CompileTimeError
void_type_function_types_test/none: CompileTimeError # Issue 30177
void_type_usage_test/param_as: CompileTimeError # Issue 30177
@@ -521,6 +540,26 @@ named_parameters_test/10: MissingCompileTimeError
named_parameters_type_test/01: MissingCompileTimeError
named_parameters_type_test/02: MissingCompileTimeError
named_parameters_type_test/03: MissingCompileTimeError
string_interpolation_test/01: MissingCompileTimeError
string_no_operator_test/01: MissingCompileTimeError
string_no_operator_test/02: MissingCompileTimeError
string_no_operator_test/03: MissingCompileTimeError
string_no_operator_test/04: MissingCompileTimeError
string_no_operator_test/05: MissingCompileTimeError
string_no_operator_test/06: MissingCompileTimeError
string_no_operator_test/07: MissingCompileTimeError
string_no_operator_test/08: MissingCompileTimeError
string_no_operator_test/09: MissingCompileTimeError
string_no_operator_test/10: MissingCompileTimeError
string_no_operator_test/11: MissingCompileTimeError
string_no_operator_test/12: MissingCompileTimeError
string_no_operator_test/13: MissingCompileTimeError
string_no_operator_test/14: MissingCompileTimeError
string_no_operator_test/15: MissingCompileTimeError
string_no_operator_test/16: MissingCompileTimeError
string_test/01: MissingCompileTimeError
super_assign_test/01: MissingCompileTimeError
substring_test/01: MissingCompileTimeError
type_variable_scope_test/00: MissingCompileTimeError
type_variable_scope_test/01: MissingCompileTimeError
type_variable_scope_test/02: MissingCompileTimeError
@@ -224,6 +224,27 @@ static_getter_no_setter1_test/01: MissingCompileTimeError
static_getter_no_setter2_test/01: MissingCompileTimeError
static_initializer_type_error_test: MissingCompileTimeError
static_setter_get_test/01: MissingCompileTimeError
string_interpolation_test/01: MissingCompileTimeError
string_no_operator_test/01: MissingCompileTimeError
string_no_operator_test/02: MissingCompileTimeError
string_no_operator_test/03: MissingCompileTimeError
string_no_operator_test/04: MissingCompileTimeError
string_no_operator_test/05: MissingCompileTimeError
string_no_operator_test/06: MissingCompileTimeError
string_no_operator_test/07: MissingCompileTimeError
string_no_operator_test/08: MissingCompileTimeError
string_no_operator_test/09: MissingCompileTimeError
string_no_operator_test/10: MissingCompileTimeError
string_no_operator_test/11: MissingCompileTimeError
string_no_operator_test/12: MissingCompileTimeError
string_no_operator_test/13: MissingCompileTimeError
string_no_operator_test/14: MissingCompileTimeError
string_no_operator_test/15: MissingCompileTimeError
string_no_operator_test/16: MissingCompileTimeError
string_test/01: MissingCompileTimeError
substring_test/01: MissingCompileTimeError
super_assign_test/01: MissingCompileTimeError
super_bound_closure_test/01: MissingCompileTimeError
type_variable_nested_test/01: RuntimeError
type_variable_promotion_test: RuntimeError
type_variable_scope_test/00: MissingCompileTimeError
@@ -56,6 +56,11 @@ accessor_conflict_import_prefixed_test: CompileTimeError # Issue 25626
accessor_conflict_import_test: CompileTimeError # Issue 25626
const_objects_are_immutable_test: RuntimeError # Issue 29897
regress_30339_test: CompileTimeError # As expected. Should we make this a multi test?
string_interpolation_and_buffer_test: RuntimeError
string_literals_test: RuntimeError
string_split_test: CompileTimeError
string_supertype_checked_test: CompileTimeError
super_bound_closure_test/none: CompileTimeError
void_type_callbacks_test/00: MissingCompileTimeError # Issue 30514
void_type_callbacks_test/01: MissingCompileTimeError # Issue 30514
void_type_function_types_test/none: CompileTimeError # Issue 30514
@@ -223,6 +223,27 @@ named_parameters_test/10: MissingCompileTimeError
named_parameters_type_test/01: MissingCompileTimeError
named_parameters_type_test/02: MissingCompileTimeError
named_parameters_type_test/03: MissingCompileTimeError
string_interpolation_test/01: MissingCompileTimeError
string_no_operator_test/01: MissingCompileTimeError
string_no_operator_test/02: MissingCompileTimeError
string_no_operator_test/03: MissingCompileTimeError
string_no_operator_test/04: MissingCompileTimeError
string_no_operator_test/05: MissingCompileTimeError
string_no_operator_test/06: MissingCompileTimeError
string_no_operator_test/07: MissingCompileTimeError
string_no_operator_test/08: MissingCompileTimeError
string_no_operator_test/09: MissingCompileTimeError
string_no_operator_test/10: MissingCompileTimeError
string_no_operator_test/11: MissingCompileTimeError
string_no_operator_test/12: MissingCompileTimeError
string_no_operator_test/13: MissingCompileTimeError
string_no_operator_test/14: MissingCompileTimeError
string_no_operator_test/15: MissingCompileTimeError
string_no_operator_test/16: MissingCompileTimeError
string_test/01: MissingCompileTimeError
substring_test/01: MissingCompileTimeError
super_assign_test/01: MissingCompileTimeError
super_bound_closure_test/01: MissingCompileTimeError
type_variable_nested_test/01: RuntimeError
type_variable_promotion_test: RuntimeError
static_field3_test/01: MissingCompileTimeError
+21
View File
@@ -237,6 +237,27 @@ static_getter_no_setter1_test/01: MissingCompileTimeError
static_getter_no_setter2_test/01: MissingCompileTimeError
static_initializer_type_error_test: MissingCompileTimeError
static_setter_get_test/01: MissingCompileTimeError
string_interpolation_test/01: MissingCompileTimeError
string_no_operator_test/01: MissingCompileTimeError
string_no_operator_test/02: MissingCompileTimeError
string_no_operator_test/03: MissingCompileTimeError
string_no_operator_test/04: MissingCompileTimeError
string_no_operator_test/05: MissingCompileTimeError
string_no_operator_test/06: MissingCompileTimeError
string_no_operator_test/07: MissingCompileTimeError
string_no_operator_test/08: MissingCompileTimeError
string_no_operator_test/09: MissingCompileTimeError
string_no_operator_test/10: MissingCompileTimeError
string_no_operator_test/11: MissingCompileTimeError
string_no_operator_test/12: MissingCompileTimeError
string_no_operator_test/13: MissingCompileTimeError
string_no_operator_test/14: MissingCompileTimeError
string_no_operator_test/15: MissingCompileTimeError
string_no_operator_test/16: MissingCompileTimeError
string_test/01: MissingCompileTimeError
substring_test/01: MissingCompileTimeError
super_assign_test/01: MissingCompileTimeError
super_bound_closure_test/01: MissingCompileTimeError
type_variable_nested_test/01: RuntimeError
type_variable_promotion_test: RuntimeError
type_variable_scope_test/00: MissingCompileTimeError
@@ -11,8 +11,9 @@ class A {
class StringInterpolation1NegativeTest {
// Dollar not followed by "{" or identifier.
static const DOLLAR = const A("$");
testMain() {
static const DOLLAR = const A("$"); //# 01: compile-time error
static testMain() {
print(DOLLAR); //# 01: continued
}
}
@@ -5,8 +5,9 @@
// A dollar must be followed by a "{" or an identifier.
class StringInterpolation2NegativeTest {
testMain() {
print('C;Y1;X4;K"$/Month"'); // Dollar followed by "/".
static testMain() {
// Dollar followed by "/".
print('C;Y1;X4;K"$/Month"'); //# 01: compile-time error
}
}
@@ -6,7 +6,8 @@
class StringInterpolation3NegativeTest {
static testMain() {
print('F;P4;F$2R'); // Dollar followed by a number.
// Dollar followed by a number.
print('F;P4;F$2R'); //# 01: compile-time error
}
}
@@ -5,9 +5,9 @@
// A dollar must be followed by a "{" or an identifier.
class StringInterpolation4NegativeTest {
testMain() {
static testMain() {
// Dollar not followed by "{" or identifier.
print("-" + "$" + "foo");
print("-" + "$" + "foo"); //# 01: compile-time error
}
}
@@ -5,8 +5,9 @@
// A dollar must be followed by a "{" or an identifier.
class StringInterpolation5NegativeTest {
testMain() {
print("$1,000"); // Dollar followed by a number.
static testMain() {
// Dollar followed by a number.
print("$1,000"); //# 01: compile-time error
}
}
@@ -5,9 +5,10 @@
// A dollar must be followed by a "{" or an identifier.
class StringInterpolation6NegativeTest {
testMain() {
static testMain() {
// Dollar not followed by "{" or identifier.
String regexp = "^(\\d\\d?)[-/](\\d\\d?)$";
String regexp;
regexp = "^(\\d\\d?)[-/](\\d\\d?)$"; //# 01: compile-time error
print(regexp);
}
}
@@ -17,34 +17,13 @@ class ToStringWrapper {
wrap(value) => new ToStringWrapper(value);
final bool checkedMode = computeCheckedMode();
bool computeCheckedMode() {
try {
var i = 42;
String s = i;
} on TypeError catch (e) {
return true;
}
return false;
}
main() {
interpolate(object) {
var result;
if (checkedMode && object != null) {
try {
result = '${wrap(object)}';
} on TypeError {
return 'Error';
} on ArgumentError {
return 'Error'; // Checked mode.
}
} else {
try {
result = '${wrap(object)}';
} on ArgumentError {
return 'Error';
}
try {
result = '${wrap(object)}';
} on ArgumentError {
return 'Error';
}
Expect.isTrue(result is String);
return 'Success';
@@ -52,20 +31,12 @@ main() {
buffer(object) {
var sb;
if (checkedMode && object != null) {
try {
sb = new StringBuffer()..write(wrap(object));
} on TypeError {
return 'Error';
} on ArgumentError {
return 'Error'; // Checked mode.
}
} else {
try {
sb = new StringBuffer()..write(wrap(object));
} on ArgumentError {
return 'Error';
}
try {
sb = new StringBuffer()..write(wrap(object));
} on ArgumentError {
return 'Error';
}
if (object == null) {
Expect.isTrue(sb.toString() is String);
}
return 'Success';
@@ -73,20 +44,12 @@ main() {
initBuffer(object) {
var sb;
if (checkedMode && object != null) {
try {
sb = new StringBuffer(wrap(object));
} on TypeError {
return 'Error';
} on ArgumentError {
return 'Error'; // Checked mode.
}
} else {
try {
sb = new StringBuffer(wrap(object));
} on ArgumentError {
return 'Error';
}
try {
sb = new StringBuffer(wrap(object));
} on ArgumentError {
return 'Error';
}
if (object == null) {
Expect.isTrue(sb.toString() is String);
}
return 'Success';
@@ -58,7 +58,7 @@ class StringInterpolationTest {
Expect.equals("}", "escaped \${3+2}"[17]);
if (alwaysFalse) {
"${i.toHorse()}"; //# 01: static type warning
"${i.toHorse()}"; //# 01: compile-time error
}
Expect.equals("${m}", "$m");
@@ -0,0 +1,38 @@
// 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.
import "package:expect/expect.dart";
main() {
var expect = new String.fromCharCodes(
[0, 0x0a, 0x0d, 0x7f, 0xff, 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff]);
test(string) {
Expect.equals(expect, string);
}
// Plain escapes of code points.
test("\x00\x0a\x0d\x7f\xff\uffff\u{10000}\u{10ffff}");
test("""\x00\x0a\x0d\x7f\xff\uffff\u{10000}\u{10ffff}""");
test('\x00\x0a\x0d\x7f\xff\uffff\u{10000}\u{10ffff}');
test('''\x00\x0a\x0d\x7f\xff\uffff\u{10000}\u{10ffff}''');
// Plain escapes of individual code units.
test("\x00\x0a\x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff");
test("""\x00\x0a\x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff""");
test('\x00\x0a\x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff');
test('''\x00\x0a\x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff''');
// Insert newline into multiline string.
test("""\x00
\x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff""");
test('''\x00
\x0d\x7f\xff\uffff\ud800\udc00\udbff\udfff''');
// Extract code points from multi-character escape string.
test("\x00\x0a\x0d\x7f\xff\uffff"
"${"\u{10000}"[0]}${"\u{10000}"[1]}"
"${"\u{10FFFF}"[0]}${"\u{10FFFF}"[1]}");
test("\x00\x0a\x0d\x7f\xff\uffff" + "\ud800" + "\udc00\udbff" + "\udfff");
// Single line string over multiple lines with newlines inside interpolation.
test("\x00\x0a\x0d\x7f\xff${
""
}\uffff\ud800\udc00\udbff\udfff");
}
@@ -0,0 +1,26 @@
// Copyright (c) 2015, 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.
import 'package:expect/expect.dart';
main() {
var x = "x";
var y = "y";
Expect.throws(() => x < y); //# 01: compile-time error
Expect.throws(() => x <= y); //# 02: compile-time error
Expect.throws(() => x > y); //# 03: compile-time error
Expect.throws(() => x >= y); //# 04: compile-time error
Expect.throws(() => x - y); //# 05: compile-time error
Expect.throws(() => x * y); //# 06: compile-time error
Expect.throws(() => x / y); //# 07: compile-time error
Expect.throws(() => x ~/ y); //# 08: compile-time error
Expect.throws(() => x % y); //# 09: compile-time error
Expect.throws(() => x >> y); //# 10: compile-time error
Expect.throws(() => x << y); //# 11: compile-time error
Expect.throws(() => x & y); //# 12: compile-time error
Expect.throws(() => x | y); //# 13: compile-time error
Expect.throws(() => x ^ y); //# 14: compile-time error
Expect.throws(() => -x); //# 15: compile-time error
Expect.throws(() => ~x); //# 16: compile-time error
}
@@ -8,7 +8,7 @@ import "package:expect/expect.dart";
class EvilMatch implements Match {
int get start => 100000000;
int get end => 3;
bool noSuchMethod(Invocation im) {} // To appease dartanalyzer.
bool noSuchMethod(Invocation im) => false; // To appease dartanalyzer.
}
class EvilIterator implements Iterator {
@@ -22,7 +22,7 @@ class EvilIterable extends Iterable {
class EvilPattern implements Pattern {
Iterable allMatches(String s, [int start = 0]) => new EvilIterable();
bool noSuchMethod(Invocation im) {} // To appease dartanalyzer.
bool noSuchMethod(Invocation im) => false; // To appease dartanalyzer.
}
void main() {
@@ -31,13 +31,7 @@ class StringTest {
static testNoSuchMethod() {
String a = "Hello";
bool exception_caught = false;
try {
a[1] = 12; // Throw exception.
} on NoSuchMethodError catch (e) {
exception_caught = true;
}
Expect.equals(true, exception_caught);
a[1] = 12; //# 01: compile-time error
}
static testCharCodes() {
@@ -7,7 +7,7 @@ import "package:expect/expect.dart";
main() {
try {
print("abcdef".substring(1.5, 3.5)); // //# 01: static type warning
print("abcdef".substring(1.5, 3.5)); // //# 01: compile-time error
Expect.fail("Should have thrown an exception"); // //# 01: continued
} on TypeError catch (e) {
// OK.
@@ -2,8 +2,6 @@
// 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.
import "package:expect/expect.dart";
class A {
int x;
}
@@ -17,6 +15,5 @@ class C extends A {
main() {
A a = new C();
a.x = 37;
a.setX(42);
Expect.equals(42, a.x);
a.setX(42); //# 01: compile-time error
}
@@ -72,15 +72,15 @@ class B extends A {
fooIntercept27() => confuse(super.lastWhere)(0);
fooIntercept28() => confuse(super.lastWhere)(3, orElse: 77);
bar([var optional]) => -1; // //# 01: static type warning
bar2({ namedOptional }) => -1; // //# 01: continued
bar([var optional]) => -1; // //# 01: compile-time error
bar2({namedOptional}) => -1; // //# 01: continued
bar3(x, [var optional]) => -1; // //# 01: continued
bar4(x, { namedOptional }) => -1; //# 01: continued
bar4(x, {namedOptional}) => -1; //# 01: continued
gee([var optional]) => -1; // //# 01: continued
gee2({ namedOptional }) => -1; // //# 01: continued
gee2({namedOptional}) => -1; // //# 01: continued
gee3(x, [var optional]) => -1; // //# 01: continued
gee4(x, { namedOptional }) => -1; //# 01: continued
gee4(x, {namedOptional}) => -1; //# 01: continued
add([var optional = 33]) => -1;
trim({namedOptional: 22}) => -1;
@@ -398,26 +398,6 @@ setter_override2_test: Skip
setter_override_test: Skip
source_self_negative_test: Skip
static_call_wrong_argument_count_negative_test: Skip
string_interpolation1_negative_test: Skip
string_interpolation2_negative_test: Skip
string_interpolation3_negative_test: Skip
string_interpolation4_negative_test: Skip
string_interpolation5_negative_test: Skip
string_interpolation6_negative_test: Skip
string_interpolation9_test: Skip
string_interpolation_and_buffer_test: Skip
string_interpolation_test: Skip
string_no_operator_test: Skip
string_split_test: Skip
string_supertype_checked_test: Skip
string_test: Skip
string_unicode1_negative_test: Skip
string_unicode2_negative_test: Skip
string_unicode3_negative_test: Skip
string_unicode4_negative_test: Skip
substring_test: Skip
super_assign_test: Skip
super_bound_closure_test: Skip
super_call3_test: Skip
super_call4_test: Skip
super_conditional_operator_test: Skip
@@ -1,26 +0,0 @@
// Copyright (c) 2015, 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.
import 'package:expect/expect.dart';
main() {
var x = "x";
var y = "y";
Expect.throws(() => x < y);
Expect.throws(() => x <= y);
Expect.throws(() => x > y);
Expect.throws(() => x >= y);
Expect.throws(() => x - y);
Expect.throws(() => x * y);
Expect.throws(() => x / y);
Expect.throws(() => x ~/ y);
Expect.throws(() => x % y);
Expect.throws(() => x >> y);
Expect.throws(() => x << y);
Expect.throws(() => x & y);
Expect.throws(() => x | y);
Expect.throws(() => x ^ y);
Expect.throws(() => -x);
Expect.throws(() => ~x);
}
-8
View File
@@ -1,8 +0,0 @@
library sub;
import '../cyclic_import_test.dart';
import 'package:expect/expect.dart';
subMain() {
Expect.equals(42, value);
}