dart-sdk/tests/lib/async/regress154963234_strong_test.dart
Nicholas Shahan 207953f367 [tests] Add regression tests for internal issue
We already landed a workaround for b/154963234 as
https://dart-review.googlesource.com/c/sdk/+/144815. Adding
these tests to ensure the followup fix doesn't break it again.

Change-Id: Ic021c2b3f0e5b3cd12ae0286ac5146c71f380aa2
Bug: b/154963234
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144988
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2020-04-28 23:49:43 +00:00

16 lines
590 B
Dart

// Copyright (c) 2020, 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.
// Requirements=nnbd-strong
import "package:expect/expect.dart";
main() {
var shortDuration = Duration(milliseconds: 5);
Expect.isTrue(Future<int?>.delayed(shortDuration) is Future);
// In strong mode not passing a computation will throw when the type argument
// passed is not nullable.
Expect.throwsArgumentError(() => Future<int>.delayed(shortDuration));
}