Migrate tests off the ancient multitest marker syntax.

Change-Id: Iae025d9c544831e24debf0a670202ced8f252a97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106201
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
This commit is contained in:
Robert Nystrom 2019-06-19 21:15:30 +00:00 committed by commit-bot@chromium.org
parent cf78d5d7f0
commit 1734133f2c
7 changed files with 79 additions and 95 deletions

View file

@ -52,20 +52,17 @@ void testSyncStarTransform(String source, String expected) {
}
main() {
testAsyncTransform(
/// 01: ok
r"""function() async {
testAsyncTransform( //# 01: ok
r"""function() async {
var closures = [new A.main_closure()], v0 = await closures, v1 = 0, v2, v3;
if (v1 < 0 || v1 >= v0.length)
H.ioore(v0, v1);
v2 = 4;
v3 = 2;
P.print(v0[v1].call$2(v2, v3));
}""",
/// 01: ok
r"""function() {
}"""
, //# 01: ok
r"""function() {
var __goto = 0,
__completer = NewCompleter(CompleterType),
closures, v0, v1, v2, v3;
@ -93,10 +90,9 @@ main() {
}
});
return startHelper(body, __completer);
}""")
/// 01: ok
;
}"""
) //# 01: ok
;
testAsyncTransform("""
function(a) async {
@ -439,7 +435,7 @@ function(x, y) async {
while (true) {
switch(y) { // Switch with no awaits in case key expressions
case 0:
case 1:
case 1:
await foo();
continue; // Continue the loop, not the switch
case 1: // Duplicate case
@ -594,7 +590,7 @@ function(g) async {
return;
}
print(await(foo(i)));
}
}
}
""", """
function(g) {

View file

@ -27,9 +27,8 @@ class Tracer {
}
Future test1(Tracer tracer) {
foo() async*
/// asyncStar: ok
foo() async
* //# asyncStar: ok
{
var savedStackTrace;
try {
@ -50,17 +49,15 @@ Future test1(Tracer tracer) {
tracer.trace("f");
}
return foo().toList()
/// asyncStar: continued
return foo()
.toList() //# asyncStar: continued
;
}
Future test2(Tracer tracer) {
var savedStackTrace;
foo() async*
/// asyncStar: continued
foo() async
* //# asyncStar: continued
{
try {
tracer.trace("a");
@ -74,9 +71,8 @@ Future test2(Tracer tracer) {
tracer.trace("d");
}
return foo().toList()
/// asyncStar: continued
return foo()
.toList() //# asyncStar: continued
.catchError((e, st) {
tracer.trace("e");
Expect.equals(savedStackTrace.toString(), st.toString());
@ -85,9 +81,8 @@ Future test2(Tracer tracer) {
Future test3(Tracer tracer) {
var savedStackTrace;
foo() async*
/// asyncStar: continued
foo() async
* //# asyncStar: continued
{
try {
tracer.trace("a");
@ -99,9 +94,8 @@ Future test3(Tracer tracer) {
}
}
return foo().toList()
/// asyncStar: continued
return foo()
.toList() //# asyncStar: continued
.catchError((e, st) {
tracer.trace("c");
Expect.equals(savedStackTrace.toString(), st.toString());

View file

@ -1041,39 +1041,39 @@ void testFromToDouble() {
main() {
for (int i = 0; i < 8; i++) {
Expect.equals(BigInt.parse("1234567890123456789"), foo()); /// 01: ok
Expect.equals(BigInt.parse("12345678901234567890"), bar()); /// 02: ok
testModPow(); /// 03: ok
testModInverse(); /// 04: ok
testGcd(); /// 05: ok
testSmiOverflow(); /// 06: ok
testBigintAnd(); /// 07: ok
testBigintOr(); /// 08: ok
testBigintXor(); /// 09: ok
testBigintAdd(); /// 10: ok
testBigintSub(); /// 11: ok
testBigintMul(); /// 12: ok
testBigintTruncDiv(); /// 12: ok
testBigintDiv(); /// 13: ok
testBigintModulo(); /// 14: ok
testBigintModPow(); /// 15: ok
testBigintModInverse(); /// 16: ok
testBigintGcd(); /// 17: ok
testBigintNegate(); /// 18: ok
testShiftAmount(); /// 19: ok
testPow(); /// 20: ok
testToRadixString(); /// 21: ok
testToString(); /// 22: ok
testFromToInt(); /// 23: ok
testFromToDouble(); /// 24: ok
Expect.equals(BigInt.parse("12345678901234567890"), /// 25: ok
BigInt.parse("12345678901234567890").abs()); /// 25: ok
Expect.equals(BigInt.parse("12345678901234567890"), /// 26: ok
BigInt.parse("-12345678901234567890").abs()); /// 26: ok
var a = BigInt.parse("10000000000000000000"); /// 27: ok
var b = BigInt.parse("10000000000000000001"); /// 27: ok
Expect.equals(false, a.hashCode == b.hashCode); /// 27: ok
Expect.equals(true, a.hashCode == (b - BigInt.one).hashCode); /// 27: ok
Expect.equals(BigInt.parse("1234567890123456789"), foo()); //# 01: ok
Expect.equals(BigInt.parse("12345678901234567890"), bar()); //# 02: ok
testModPow(); //# 03: ok
testModInverse(); //# 04: ok
testGcd(); //# 05: ok
testSmiOverflow(); //# 06: ok
testBigintAnd(); //# 07: ok
testBigintOr(); //# 08: ok
testBigintXor(); //# 09: ok
testBigintAdd(); //# 10: ok
testBigintSub(); //# 11: ok
testBigintMul(); //# 12: ok
testBigintTruncDiv(); //# 12: ok
testBigintDiv(); //# 13: ok
testBigintModulo(); //# 14: ok
testBigintModPow(); //# 15: ok
testBigintModInverse(); //# 16: ok
testBigintGcd(); //# 17: ok
testBigintNegate(); //# 18: ok
testShiftAmount(); //# 19: ok
testPow(); //# 20: ok
testToRadixString(); //# 21: ok
testToString(); //# 22: ok
testFromToInt(); //# 23: ok
testFromToDouble(); //# 24: ok
Expect.equals(BigInt.parse("12345678901234567890"), //# 25: ok
BigInt.parse("12345678901234567890").abs()); //# 25: ok
Expect.equals(BigInt.parse("12345678901234567890"), //# 26: ok
BigInt.parse("-12345678901234567890").abs()); //# 26: ok
var a = BigInt.parse("10000000000000000000"); //# 27: ok
var b = BigInt.parse("10000000000000000001"); //# 27: ok
Expect.equals(false, a.hashCode == b.hashCode); //# 27: ok
Expect.equals(true, a.hashCode == (b - BigInt.one).hashCode); //# 27: ok
// Regression test for http://dartbug.com/36105
var overbig = -BigInt.from(10).pow(309);

View file

@ -3,18 +3,18 @@
// BSD-style license that can be found in the LICENSE file.
class A {
final x; // //# 01: ok
/// 02: compile-time error
var x; // //# 03: compile-time error
final x; //# 01: ok
//# 02: compile-time error
var x; //# 03: compile-time error
get x => null; //# 04: compile-time error
set x(v) {} // //# 05: compile-time error
set x(v) {} //# 05: compile-time error
const A()
: x = 'foo' // //# 01: continued
: x = 'foo' // //# 02: continued
: x = 'foo' // //# 03: continued
: x = 'foo' // //# 04: continued
: x = 'foo' // //# 05: continued
: x = 'foo' //# 01: continued
: x = 'foo' //# 02: continued
: x = 'foo' //# 03: continued
: x = 'foo' //# 04: continued
: x = 'foo' //# 05: continued
;
}

View file

@ -18,12 +18,6 @@ test(a, b) {
main() {
test(const A<int Function()>(), const A<String Function()>());
/// 01: ok
test(const A<int>(), const A<String Function()>());
/// 02: ok
test(const A<int Function()>(), const A<String>());
/// 03: ok
}

View file

@ -8,8 +8,8 @@ class X {
}
void main() {
print(const X(1 << -1).x); /// 01: compile-time error
print(const X(1 >> -1).x); /// 02: compile-time error
print(const X(1 % 0).x); /// 03: compile-time error
print(const X(1 ~/ 0).x); /// 04: compile-time error
print(const X(1 << -1).x); //# 01: compile-time error
print(const X(1 >> -1).x); //# 02: compile-time error
print(const X(1 % 0).x); //# 03: compile-time error
print(const X(1 ~/ 0).x); //# 04: compile-time error
}

View file

@ -5,15 +5,15 @@
import 'package:expect/expect.dart';
void main() {
print(const Symbol(null)); /// 01: compile-time error
print(const Symbol(r'')); /// 02: ok
Expect.isTrue(identical(const Symbol(r'foo'), #foo)); /// 03: ok
Expect.isTrue(identical(const Symbol(r'$foo'), #$foo)); /// 03: ok
Expect.isTrue(identical(const Symbol(r'$_'), #$_)); /// 03: ok
Expect.isTrue(identical(const Symbol(r'+'), #+)); /// 03: ok
Expect.isTrue(identical(const Symbol(r'[]='), #[]=)); /// 03: ok
Expect.isTrue(identical(const Symbol(r'_foo'), #_foo)); /// 03: compile-time error
Expect.isTrue(identical(const Symbol(r'_$'), #_$)); /// 03: compile-time error
Expect.isTrue(identical(const Symbol(r'_foo$'), #_foo$)); /// 03: compile-time error
print(const Symbol(r'_+')); /// 03: compile-time error
print(const Symbol(null)); //# 01: compile-time error
print(const Symbol(r'')); //# 02: ok
Expect.isTrue(identical(const Symbol(r'foo'), #foo)); //# 03: ok
Expect.isTrue(identical(const Symbol(r'$foo'), #$foo)); //# 03: ok
Expect.isTrue(identical(const Symbol(r'$_'), #$_)); //# 03: ok
Expect.isTrue(identical(const Symbol(r'+'), #+)); //# 03: ok
Expect.isTrue(identical(const Symbol(r'[]='), #[]=)); //# 03: ok
Expect.isTrue(identical(const Symbol(r'_foo'), #_foo)); //# 03: compile-time error
Expect.isTrue(identical(const Symbol(r'_$'), #_$)); //# 03: compile-time error
Expect.isTrue(identical(const Symbol(r'_foo$'), #_foo$)); //# 03: compile-time error
print(const Symbol(r'_+')); //# 03: compile-time error
}