forked from dart-lang/co19
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dart-lang#2398. Update async tests to avoid false-positive results on…
… web. Language and LanguageFeatures tests
- Loading branch information
Showing
39 changed files
with
54 additions
and
74 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,9 +9,7 @@ | |
/// @description Check that it is a compile error if unaryExpression is missing | ||
/// @author [email protected] | ||
|
||
import 'dart:async'; | ||
import '../../../Utils/expect.dart'; | ||
|
||
f() { | ||
return new Future<int>.value(1); | ||
|
@@ -25,6 +23,5 @@ Future test() async { | |
} | ||
|
||
main() { | ||
asyncStart(); | ||
test().then( (value) => asyncEnd() ); | ||
test(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,9 +9,7 @@ | |
/// @description Check that it is a compile error if unaryExpression is missing | ||
/// @author [email protected] | ||
|
||
import 'dart:async'; | ||
import '../../../Utils/expect.dart'; | ||
|
||
f() { | ||
return new Future<int>.value(1); | ||
|
@@ -25,6 +23,5 @@ Stream test() async* { | |
} | ||
|
||
main() { | ||
asyncStart(); | ||
test().isEmpty.then( (value) => asyncEnd() ); | ||
test(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,9 +11,7 @@ | |
/// enclosing await expression is not marked with async, async* or sync* | ||
/// @author [email protected] | ||
|
||
import 'dart:async'; | ||
import '../../../Utils/expect.dart'; | ||
|
||
f() { | ||
return new Future<int>.value(1); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,9 +11,7 @@ | |
/// enclosing await expression is marked with sync* | ||
/// @author [email protected] | ||
|
||
import 'dart:async'; | ||
import '../../../Utils/expect.dart'; | ||
|
||
f() { | ||
return new Future<int>.value(1); | ||
|
@@ -27,5 +25,5 @@ Iterable test() sync* { | |
} | ||
|
||
main() { | ||
Expect.isTrue(test().isEmpty); | ||
test(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
/// @description Check a run-time type of a return value of a synchronous | ||
/// generator function | ||
/// @author [email protected] | ||
/// @issue 54159 | ||
import "dart:async"; | ||
import "../../Utils/expect.dart"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
/// return type derives the union-free type `S`, and assume that `S` implements | ||
/// `Iterable<U>`. Then check that the element type of `f` is `U`. | ||
/// @author [email protected] | ||
/// @issue 54159 | ||
import "dart:async"; | ||
import "../../Utils/expect.dart"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
/// return type derives the union-free type `S`, and assume that `S` implements | ||
/// `Iterable<U>`. Then check that the element type of `f` is `U`. | ||
/// @author [email protected] | ||
/// @issue 54159 | ||
import "dart:async"; | ||
import "../../Utils/expect.dart"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ | |
/// @description Check a run-time type of a returned value of an asynchronous | ||
/// generator function | ||
/// @author [email protected] | ||
/// @issue 54159 | ||
import "dart:async"; | ||
import "../../Utils/expect.dart"; | ||
|
@@ -27,6 +28,7 @@ void isRuntimeTypeImplementsStream<T>(Object? o) async { | |
List<T> list = await o.toList(); | ||
try { | ||
list.addAll(<T>[]); | ||
asyncEnd(); | ||
} on TypeError catch (_) { | ||
throw ExpectException("Expected Stream<$T> but found $o"); | ||
} | ||
|
@@ -39,7 +41,9 @@ FutureOr<Stream<int>?> foo() async* { | |
} | ||
|
||
main() async { | ||
asyncStart(2); | ||
dynamic d = await foo(); | ||
FutureOr<Stream<int>> o = d; | ||
isRuntimeTypeImplementsStream<int>(d); | ||
asyncEnd(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
/// return type derives the union-free type `S`, and assume that `S` implements | ||
/// `Stream<U>`. Then check that the element type of `f` is `U`. | ||
/// @author [email protected] | ||
/// @issue 54159 | ||
import "dart:async"; | ||
import "../../Utils/expect.dart"; | ||
|
@@ -29,6 +30,7 @@ void isRuntimeTypeImplementsStream<T>(Object? o) async { | |
List<T> list = await o.toList(); | ||
try { | ||
list.addAll(<T>[]); | ||
asyncEnd(); | ||
} on TypeError catch (_) { | ||
throw ExpectException("Expected Stream<$T> but found $o"); | ||
} | ||
|
@@ -41,7 +43,9 @@ FutureOr<Stream<int>?> foo() async* { | |
} | ||
|
||
main() async { | ||
asyncStart(2); | ||
var o = await foo(); | ||
o.expectStaticType<Exactly<Stream<int>?>>(); | ||
isRuntimeTypeImplementsStream<int>(o); | ||
asyncEnd(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
/// return type derives the union-free type `S`, and assume that `S` implements | ||
/// `Stream<U>`. Then check that the element type of `f` is `U`. | ||
/// @author [email protected] | ||
/// @issue 53051 | ||
/// @issue 53051, 54159 | ||
import "dart:async"; | ||
import "../../Utils/expect.dart"; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.