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:
committed by
commit-bot@chromium.org
parent
f80517d38a
commit
99285ebe13
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user