Add nnbd_mode_test to package:expect.

This test confirms that the NNBD mode predicates are consistent with
equivalent dynamic tests.

Change-Id: Ifeb2b9a14144ce3bee10580c80fd4a1aeea43c32
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148581
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
This commit is contained in:
Mayank Patke
2020-05-19 06:55:30 +00:00
committed by commit-bot@chromium.org
parent f80517d38a
commit 99285ebe13
+19
View File
@@ -0,0 +1,19 @@
// 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.
import "package:expect/expect.dart";
final bool strong = () {
try {
int i = null as dynamic;
return false;
} catch (e) {
return true;
}
}();
void main() {
Expect.equals(strong, isStrongMode);
Expect.equals(!strong, isWeakMode);
}