[tests] Fix expectations in language/async_star/async_star_await_for_test

According to the language specification:
1) When 'break' is executed in the 'await for' loop (in 'main'),
the underlying stream subscription is canceled.
2) When async* function ('consume') has stopped at 'yield' or 'yield*',
and the stream is canceled, the 'yield' / 'yield*' statement returns
without an object. It also means that code in 'consume()' after
the loop is not executed and it doesn't append ")" to the log.
So the test expectations are fixed to avoid expecting trailing ")"
at the log when there is a 'break' out of the 'await for' loop.

Fixes https://github.com/dart-lang/sdk/issues/51097

Change-Id: Ia59e87ef84dcb8a0c06a47f497cc97d4c6635d27
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285343
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
Alexander Markov 2023-02-27 16:25:50 +00:00 committed by Commit Queue
parent 3c4ca52b2f
commit b285115893
6 changed files with 6 additions and 18 deletions

View file

@ -215,7 +215,7 @@ main() async {
if (trace.contains("B1?2")) {
message += " (did not break in time)";
}
Expects.equals(r"(^?1!1y1[e1B1$)", trace, message);
Expects.equals(r"(^?1!1y1[e1B1$", trace, message);
}
// Yield* at 1.
@ -319,7 +319,7 @@ main() async {
if (trace.contains("e1?2")) {
message += " (did not cancel in time)";
}
Expects.equals(r"(^?1!1Y1[e1B1$)", trace, message);
Expects.equals(r"(^?1!1Y1[e1B1$", trace, message);
}
// Yield* at 1, pause at yield, then break at yield.
@ -339,7 +339,7 @@ main() async {
await Future.delayed(Duration(milliseconds: 10));
var trace = log.join("");
String message = "yield* then pause then break at 1";
Expects.equals(r"(^?1!1Y1[e1<>B1$)", trace, message);
Expects.equals(r"(^?1!1Y1[e1<>B1$", trace, message);
}
Expects.summarize();

View file

@ -13,9 +13,6 @@ vm/regress_24517_test: Pass, Fail # Issue 24517.
[ $compiler != dart2analyzer && $runtime == dart_precompiled ]
mixin/mixin2_test: Skip
[ $compiler == dartkp && $runtime == dart_precompiled ]
async_star/async_star_await_for_test: RuntimeError
[ $runtime == dart_precompiled && $minified ]
enum/duplicate_test/*: Skip # Uses Enum.toString()
enum/enum_test: Skip # Uses Enum.toString()

View file

@ -16,9 +16,6 @@ assert/initializer_const_error2_test/cc09: MissingCompileTimeError # Not reporti
assert/initializer_const_error2_test/cc10: MissingCompileTimeError # Not reporting failed assert() at compile time.
assert/initializer_const_error2_test/cc11: MissingCompileTimeError # Not reporting failed assert() at compile time.
[ $runtime == vm ]
async_star/async_star_await_for_test: RuntimeError
[ $arch == arm64 && $runtime == vm ]
class/large_class_declaration_test: SkipSlow # Uses too much memory.
closure/cycles_test: Pass, Slow

View file

@ -217,7 +217,7 @@ main() async {
if (trace.contains("B1?2")) {
message += " (did not break in time)";
}
Expects.equals(r"(^?1!1y1[e1B1$)", trace, message);
Expects.equals(r"(^?1!1y1[e1B1$", trace, message);
}
// Yield* at 1.
@ -321,7 +321,7 @@ main() async {
if (trace.contains("e1?2")) {
message += " (did not cancel in time)";
}
Expects.equals(r"(^?1!1Y1[e1B1$)", trace, message);
Expects.equals(r"(^?1!1Y1[e1B1$", trace, message);
}
// Yield* at 1, pause at yield, then break at yield.
@ -341,7 +341,7 @@ main() async {
await Future.delayed(Duration(milliseconds: 10));
var trace = log.join("");
String message = "yield* then pause then break at 1";
Expects.equals(r"(^?1!1Y1[e1<>B1$)", trace, message);
Expects.equals(r"(^?1!1Y1[e1<>B1$", trace, message);
}
Expects.summarize();

View file

@ -13,9 +13,6 @@ vm/regress_24517_test: Pass, Fail # Issue 24517.
[ $compiler != dart2analyzer && $runtime == dart_precompiled ]
mixin/mixin2_test: Skip
[ $compiler == dartkp && $runtime == dart_precompiled ]
async_star/async_star_await_for_test: RuntimeError
[ $runtime == dart_precompiled && $minified ]
enum/duplicate_test/*: Skip # Uses Enum.toString()
enum/enum_test: Skip # Uses Enum.toString()

View file

@ -16,9 +16,6 @@ assert/initializer_const_error2_test/cc09: MissingCompileTimeError # Not reporti
assert/initializer_const_error2_test/cc10: MissingCompileTimeError # Not reporting failed assert() at compile time.
assert/initializer_const_error2_test/cc11: MissingCompileTimeError # Not reporting failed assert() at compile time.
[ $runtime == vm ]
async_star/async_star_await_for_test: RuntimeError
[ $arch == arm64 && $runtime == vm ]
class/large_class_declaration_test: SkipSlow # Uses too much memory.
closure/cycles_test: Pass, Slow